There are a lot of approaches to this. Lets take them one at a time:
- Using NOSCRIPT tag: You can write a noscript tag just before your script tag to display the user a warning message. Check the code below, wherein the user will be redirected to another page if javascript is disabled:
<html>
<head>
<title>Untitled</title><noscript><meta http-equiv=”refresh” content=”0; url=whatyouwant.html”></noscript>
</head>
<body>
<form>
<!–this javascript ensures that anybody that doesnt use javascript wont see the menu–>
<script type=”text/javascript”>
<!–hide script from older browsers
document.write(‘<select name=”whatever”><option>1</option><option>2</option></select>’);
–>
</script>
</form>
</body>
</html>
- Check out this interesting article on 15 seconds, Creating a Server Control for JavaScript Testing by George Masselli. It explains how to create a control that verifies whether Javascript is supported and enabled. Apparently it is not easy to determine if a user disabled Javascript support for security reasons.
- Check out this interesting article on CodeProject, Check if JavaScript is Enabled from Server-Side Using an User Control by Krushna Samantha. Quite useful for ASP .Net developers.
- A simple concept of hiding the always visible warning message through javascript. In this case, if your browser has javascript enabled, the script will hide the message. However, if it has javascript disabled, the message will be visible always. Check the snippet below:
<body onload=”valid()”>
<form id=”form1″ runat=”server”>
<label Id=”lblWarning”>Your Browser has Disabled Scripting</label>
</form>
<script type=”text/jscript”>
function valid()
{
var lbl=document.getElementById(‘lblWarning’);
lbl.style.display = ‘none’;
}
</script></body>
Hope this was useful. Feel free to add on more options.
What i do not understood is in truth how you are not actually a lot more neatly-liked than you might be now. You’re very intelligent. You know thus considerably when it comes to this topic, produced me personally imagine it from a lot of varied angles. Its like men and women don’t seem to be interested until it something to do with Lady gaga! Your individual stuffs outstanding. At all times care for it up!
This is working fine tested.Great Idea.