Script & noscript tag in html pagesUser browser runs client side scripts in the html page. To run the inline script codes we have to keep the code block within <script> and </script> tags.
All the codes within these tags will be executed by the (client side) browser. With the introduction of Ajax the script tag is frequently used and client side scripting is playing a major role in developing web pages.
ExampleUse this code and save as code.js file
Create another file using this code and save as main.html
Open main.html file in your browser and you will see this message
Attributesasync : Script executes asynchronously,
defer: Script executes only when the page finished parsasing.
src: The URL is given here .
One such widely used external library is JQuery. This is how we include Jquery in our page.
While using such external libraries take care that you use reputed or established scripts of reputed sites only. Don't include any malicious code or codes inserting unintended ads , messages etc.
Script execution supportClient browser setting can be changed to not to execute scripts. You can get all details on how to enable or disable script it here. If the script execution is disabled then we can use <noscript> tag and give a message to the user. Here we have used <noscript> html tag. Here is an example.
You can see the uses of this at our PHP Ajax section.