Introduction
In this short post, am going to show you how to detect if Javascript is disabled using noscript tag.
The <noscript> element provides an alternate and simplest way to create content for the users that either have either disabled javascript on their browsers or browsers don't support JavaScript framework.
This element can contain any HTML element other than the <script> tag that can be included in the <HTML> element.
Let's have a simple example for detailed clarification.
<!DOCTYPE html>
<html>
<body>
<h1>noscript example</h1>
<p>If the user have a browser with JavaScript disabled will show the text inside the noscript element and "Welcome to Emmason Community!" will not be shown</p>
<script>
document.write("Welcome to Emmason Community!")
</script>
<noscript>Javascript is either disabled or not support on this broswer </noscript>
</body>
</html>
In the above example, we have used the javascript to print the message "Welcome to Emmason Community!" and also used <nonscript> element to print the message "Javascript is either disabled or not support on this broswer".
The <noscript> element will print "Javascript is either disabled or not support on this broswer" as alternative message only if JavaScript is disabled in the user's browser or his browser does not support JavaScript at all.
You might also like
3 simple ways to add javascript to HTML document
Or
working with javascript arrays
That is all. Thanks for reading