Monday, 6 April 2015

The NOSCRIPT Element in JavaScript



Any content contained in a <noscript> element will be displayed under only the following two circumstances:

  •  The browser doesn’t support scripting.
  • The browser’s scripting support is turned off.

If either of these conditions is met, then the content inside the <noscript> element is rendered. In all other cases, the browser does not render the content of <noscript>.
<!DOCTYPE html>
<html>
<head>
<title>Example HTML Page</title>
<script type=”text/javascript” defer=”defer” src=”example1.js”></script>
<script type=”text/javascript” defer=”defer” src=”example2.js”></script>
</head>
<body>
<noscript>
<p>This page requires a JavaScript-enabled browser.</p>
</noscript>
</body>
</html>
In this example, a message is displayed to the user when the scripting is not available. For scripting enabled browsers, this message will never be seen even though it is still a part of the page.



No comments:

Post a Comment