JS Coding Questions Logo
JS Coding Questions
#184💼 Interview💻 Code

How do you detect if javascript is disabled on the page

Advertisement

728x90

You can use the <noscript> tag to detect javascript disabled or not. The code block inside <noscript> gets executed when JavaScript is disabled, and is typically used to display alternative content when the page generated in JavaScript.

javascript
1<script type="javascript">
2  // JS related code goes here
3  </script>
4  <noscript>
5  <a href="next_page.html?noJS=true">JavaScript is disabled in the page. Please click Next Page</a>
6  </noscript>

Advertisement

Responsive Ad
🎯 Practice NowRelated Challenge

JavaScript Coding Exercise 13

Test your knowledge with this interactive coding challenge.

Start Coding

Advertisement

728x90
184of476