Douglas Crockford

Blog

Books

Videos

2020 Appearances

JavaScript

JSLint

JSON

Github

How JavaScript Works

Layer8

About


Start voting now!

Best viewed with Netscape Navigator

When Netscape added JavaScript to their Navigator web browser, there were no applicable standards, recommendations, or best practices. They just put it all together very quickly in a way that seemed to make sense. They needed a place to put resources about the browser itself, so to the global window object they attched a navigator object which was a grabbag of potentially useful stuff.

This is an excerpt from your browser's navigator object

It gave access to the status of the Java JVM, which was important at the time, as well as the plugins, which were used to make sounds and animations. It told you what OS you were on in case you wanted to mitigate OS-specific bugs. For example, IE Mac performed very differently from IE Win. And they put in the userAgent string and the name of their company and the project name: Mozilla (the monster that would destroy the Mosaic browser).

When Microsoft made their Internet Explorer browser, they also included a navigator object. They were very much aware that navigator was the name of their competitor's product. They replaced the product name strings to reflect that this navigator object was in a Microsoft product.

Recall that at that time, there was a web standards vacuum. There was no official recommendation or guidance for the design and construction of a modern web browser. Lacking standards, these two highly competitive companies would sometimes copy each other (risking intellectual property lawsuits) or just make stuff up. As a result, the behavior of the two browsers diverged wildly. It was extremely challenging to produce webpages that behaved identically, or even adequately, on both products. Since Netscape got a head start, many webmasters decided to focus all of their attention on Netscape Navigator, offering users of Internet Explorer an inferior presentation or failure. It became popular to put Best viewed with Netscape Navigator warnings on such pages with links to Netscape's download site. To mitigate the failure cases, servers would send a nagging instructional page if they did not see "Mozilla" in the userAgent string. They would inhibit scripts if navigator.appName was not "Netscape".

This became a best practice. It was routinely done even for pages that Internet Explorer could adequately handle. Microsoft was having difficulty winning marketshare in this situation so they did a terribly resonable thing. They changed their navigator and userAgent to identify Internet Explorer as Netscape Mozilla. When Apple brought out a browser, they did that too. So did Google.

The Netscape company and its browser have been dead for years. There is a living webstandard that requires that every browser, regardless of provenance, identify itself as Netscape Mozilla. The web is literally made of lies.

The World Wide Web should have died when Netscape died. Miraculously, it survived.