Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Web
Expertise: Beginner
Sep 28, 1998

JavaScript On or Off?

When using JavaScript in your Web pages, you should keep in mind that a user's browser might not support JavaScript. This could either be because the browser is old or because the user disabled JavaScript. Either way, the <NOSCRIPT> tag provides a solution. Any HTML enclosed between <NOSCRIPT> and </NOSCRIPT> will only be displayed if JavaScript is unavailable. This solution works in Navigator 1.22 as well as 3.0 and above, but not in Navigator 2.x.

You can also alert users that JavaScript is required and provide them with help on either downloading a compatible browser or re-enabling JavaScript support. One solution is to include a <META REFRESH> tag inside a set of <NOSCRIPT> tags in the <HEAD> portion of the page, which will re-direct users without JavaScript (and those using Navigator 2.02) to a different page.

 
<HTML>
<HEAD>
<SCRIPT LANGUAGE="Javascript">
<!--
document.write("JavaScript is on!");
//-->
</SCRIPT>
<NOSCRIPT><META HTTP-EQUIV="REFRESH" CONTENT="0;URL=nojs.htm"></NOSCRIPT>
</HEAD>
<BODY>
This document requires JavaScript. If JavaScript is unavailable you'll be 
automatically re-directed to an alternate page.
</BODY>
</HTML>
Boris Feldman
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date