X



Home>Tutorial>

How to Detect if Javascript is Disabled using noscript tag

Nuelson Penuel Saturday, September 19, 2020 Javascript

Introduction In this short post, am going to show you how to detect if Javascript is disabled using noscript tag.

The HTML noscript Element

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.

How to Detect if Javascript is Disabled

<!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

| | Views(710)

See Demo | Download File


Add your comment. Indicate code using code tag


Words: 0 | Chars: 0 | Reading Duration: 0



Images Attachment




Emmason Integratded Services(2017-2024)
All Rights Reserved
Designed and Maintained By Emmason Integrated Services