Check if Javascript is disabled in Asp.net C# - OmIndia

Teach To India

Friday, November 24, 2017

Check if Javascript is disabled in Asp.net C#

Check if JavaScript is disabled

Request.Browser.JavaScript only indicates whether the browser handles the JavaScript or not. You can turn off the JavaScript and it will still say "true". Here is a simple way to test if the JavaScript is enabled or not.
You print a message on the page saying "If you see the message below then the JavaScript is enabled". This means if the message is not displayed then the JavaScript is disabled.








<body onload="checkJavaScriptValidity()">


<script language="javascript" type="text/javascript">

function checkJavaScriptValidity() 
{
    document.getElementById("divDisplay").innerHTML = "If you see this message then               your JavaScript is enabled."; 
}

</script>


No comments:

Post a Comment

Comments

Popular