Script and Noscript Element in HTML

Script and Noscript Element in HTML 

 
The Script element is used in the HTML file for using the JavaScript in the code. JavaScript allows us to enhance the functionality of the HTML file. The Noscript element is used to display the alternate text on the browser that does not support scripts.
 
An HTML file named: "SCRIPT_NOSCRIPT.html", Let's understand the use of Script and Noscript elements in HTML file.
 
Write the Code :
  1. <!DOCTYPEHTML>  
  2. <html>  
  3.     <head>  
  4.         <script type="text/javascript"> 
  5.         document.write("Welcome in HTML World")  
  6.     </script>  
  7.     </head>  
  8.     <body>  
  9.         <noscript>  
  10.         JavaScript is disabled or not to your Browser.  
  11.     </noscript>  
  12.     </body>  
  13. </html>  
Here the Scripted text is “Welcome in HTML world”, If our Web browser supports JavaScript it will show Welcome in HTML World otherwise it will display Noscript Content.
 
Output When Browser JavaScript Supporting:
 
Script-and-Noscript-Element-in-HTML-1.jpg
 
Now Disable the Java Script from your Browser(Google Chrome):
 
Steps for Disabling JavaScript from your Browser:
  1. Click on Customize and control Google Chrome button at the top corner and select the “Setting” option from the context menu.
     
    Script-and-Noscript-Element-in-HTML-2.jpg
     
    After Clicking on setting option:
     
    Script-and-Noscript-Element-in-HTML-3.jpg
     
  2. Select the Show advance Setting then Click on Privacy >> Content Setting :
     
    Script-and-Noscript-Element-in-HTML-4.jpg
     
  3. Select the Do Not allow any Site to Run JavaScript radio button in the JavaScript section to disable the JavaScript.
     
    Script-and-Noscript-Element-in-HTML-5.jpg
     
  4. Close the Setting page and Open the SCRIPT_NOSCRIPT.HTML file, Now it will show the content written in Noscript Element. "JavaScript is disabled or not to your Browser.
     
    Script-and-Noscript-Element-in-HTML-6.jpg