We will discuss how to find whether our Browser supports JavaScript or not. For this, we need to use the <noscript> tag, which defines an alternate text to be displayed to users who have disabled <script> tag in their Browsers. Since JavaScript is written inside <script> tag in HTML document, the JavaScript would not be supported by that browser that has disabled <script> tag.
The <noscript> tag can be used inside both <head> and <body> tags. If <noscript> tag is present inside the <head> then, <link>, <meta> and <style> tag could only be inserted inside <noscript> tag.
Syntax:
<noscript> content </noscript>
Example:
HTML
<!DOCTYPE html> < html > < body > < h1 >Verify if browser supports JavaScript</ h1 > < p > "neveropen" will be displayed by browser if it supports JavaScript </ p > < script > document.write("neveropen"); </ script > < noscript > Sorry, JavaScript is not supported by your browser! </ noscript > </ body > </ html > |
Output: If JavaScript is supported.
Disable JavaScript in Google Chrome:
- Click on the “Customize and control Google Chrome” and select “Settings”.
- Under the “Privacy and security” click on the “Site Settings…”.
- When the dialog window opens, look for the “JavaScript” section of “Content” topic and select “Don’t allow sites to use JavaScript”.
- Close the “Settings” tab.
- Reload this page of the web browser to refresh the page.
Refer the image for setting:
Now run the above HTML example code.
Output: If JavaScript is not supported,