Browser support for different versions of JavaScript

AnyBrowser.com provides information for IE 2 to IE 5, Netscape 2 to Netscape 6, and AOL 3 to 5. This covers JavaScript 1.3 (IE 5 and AOL 5) and JavaScript 1.4 (Netscape 6).

Mozilla.org provides information for JavaScript 1.0 to JavaScript 1.7, but only for Netscape and Mozilla/Firefox. JavaScript 1.5 is Navigator 6 and Mozilla 0.6x-0.9x, JavaScript 1.6 is Firefox 1.5, and JavaScript 1.7 is Firefox 2.

Interestingly, JavaScript 1.4 is listed as n/a on Mozilla, and Netscape 6 under JavaScript 1.5, but AnyBrowser has 6 under 1.4 ...

Using the Web as my guide, I've determined two ways that I believe will test for JavaScript 1.6 and JavaScript 1.7 support, based upon the following two pages.

For JavaScript 1.6, I'll be using the following code snippet.

var num = 15;
document.write(String.replace(num, /5/, '2') + " (should be '12')<br />\n");

For JavaScript 1.7, I'll be using this code, as well as the previous code.

var x = 5;
var y = 0;
document.write( let(x = x + 10, y = 12) x+y + " (should be '27')<br />\n");
document.write(x+y + "<br />\n");

The testing page is available on my CFDeveloper site.

First, if you know of any code that I can use to test JavaScript 1.5 and 1.4 support, please post or email to me, so I can add that to my testing page.

Second, if you can test a different browser/version, please also post your results.

Testing results

My testing of Firefox 2.0.0.1, Internet Explorer 7.0.5730.11, and Opera 9.10. Since the current version of Netscape uses either IE or FF for rendering, I've skipped any testing of it.

Firefox 2.0.0.1 displays one line for JavaScript 1.5 and less. These are simple document.write()s, so they should display in most browsers. Version information is passed through language, not the type, and the type is text/javascript. In addition, it displays the scripts for 1.6 and 1.7 whether the type is text/javascript or application/javascript, and the version is stated. For 1.6, it doesn't display the 1.7 code if the type is text/javascript, with no version. It does for 1.6. So, 1.6 has three groups of two lines, while 1.7 has two groups of four lines. From what I can tell, this is expected behaviour.

Internet Explorer 7.0.5730.11 and Opera 9.10 have the same display for this page. Through JavaScript 1.5, they each have one line for each - which is to be expected. For 1.6, they have a single line, which is the first, and simple, document.write() of some text. No version is passed, and the type is set to text/javascript. At this point, nothing else is displayed. For 1.7, nothing is displayed.

If, for 1.6, we change <script language="javascript1.6" type="text/javascript"> to <script language="javascript1.6" type="application/javascript">, only Opera keeps the initial document.write for 1.6. Internet Explorer displays nothing under the 1.6 heading.

Current conclusions

Based upon this initial testing, it appears that application/javascript, and setting the version in the type, is not supported by the current version of Internet Explorer. In addition, Firefox is the only one of the three browsers tested that supports up to JavaScript 1.7. Based upon how IE and Opera behaved with the JavaScript 1.6 test, I'd say that there is no support for 1.6 features, but that doesn't stop them from giving it a go. If they run into a problem, they appear to quit looking through the script block.

I'd be very interested in documentation regarding this, so if you know more, please do post what you can share.