HTML noscript Tag
By Stephen Bucaro
The HTML <noscript> tag is used to define alternate content for users who have a browser that doesn't
support script or that have disabled scripts in their browser. Today, the web is highly dependent upon scripts
and any user whose browser does not support scripting is not going to have a useful browsing experience.
So the main purpose of the noscript tag today is to handle users that have disabled scripts in their browser.
Since the main motive for a user to disable scripts in their browser is to block advertising or assist in
other copyright violations, the noscript tag can be used to redirect such users to a page that explains why
they are being booted from your website. An example of use of the noscript tag is shown below:
<noscript><meta http-equiv="refresh" content="2000; url=http://bucarotechelp.com/search/unblock.asp" /></noscript>
Whether the <noscript> tag can be used in the or sections of a webpage depends upon the page's
!DOCTYPE declaration. With any !DOCTYPE declaration previous to html5, the <noscript> tag can be used only in
the <body> section. With the html5 !DOCTYPE declaration <!doctype html>, the <noscript> tag can be used in
either the <head> or <body> sections of a webpage. When used inside the <head> section,
<noscript> can contain only <link>, <style>, and <meta> elements.
If a browser doesn't support script or has scripts disabled, the script code will not be executed but will be
visible to the user. One common practice is to use the comment tag to hide scripts from browsers without support
for scripts. This is shown below:
<script>
<!--
function showMessage()
{
alert("Hello World!")
}
//-->
</script>
However any user with or without support for scripts can view the page's script code by clicking on the browsers
View Source button.
More HTML Code: • HTML List Basics • HTML Linking Basics • HTML5 Spinbox Control • Radio Button Basics • HTML Text Tags Basics • Use fieldset to Organize Form Elements • Aligning an Image on Your Web Page • HTML abbr and acronym Tag • HTML Frames Basics • Use Datalist Tag to Specify Pre-defined Text for Input Element
|