You are here:About>Computing & Technology>JavaScript
About.comJavaScript

Stephen's JavaScript Blog

From Stephen Chapman,
Your Guide to JavaScript.
FREE Newsletter. Sign Up Now!

HTML Comments and JavaScript

What happens when you include HTML comments inside your JavaScript?

When JavaScript was first introduced, only Netscape 2 supported it and so it was necessary to hide the JavaScript from browsers such as Netscape 1 and IE2 which didn't understand the script tag and would therefore display the script instead of running it. Many people still include the HTML comment code to hide the script from the huge number of visitors that they get who still use Netscape 1 and IE2. For those of us who don't have any visitors who still use such antiquated browsers we can remove those comments. Let's take a look at how we should be coding our embedded JavaScript now (as opposed to how it needed to be don way back in the 20th Century).

HTML Comments and JavaScript
Tuesday May 6, 2008 | comments (0)

Email to a Friend

Display Latest Headlines | | | Read Archives

powered by WordPress

 All Topics | Email Article | | |
Advertising Info | News & Events | Work at About | SiteMap | Reprints | HelpOur Story | Be a Guide
User Agreement | Ethics Policy | Patent Info. | Privacy Policy©2008 About, Inc., A part of The New York Times Company. All rights reserved.