Which browsers support which versions of JavascriptWhich browsers support which versions of Javascript

Posted June 7th, 2008 in Javascript

As well as putting "javascript" as the language or type element of the <script> tag you can specify a version, for example javascript1.5. What this means is that browsers that do not support that version of Javascript will not run the code in that <script> block. I was interested to find out if this meant a simple way of determine which browser was being run with Javascript but as my findings in this post show it's not...

Testing Script

The script I used for testing is as follows. It's pretty simple: for each of the possible Javascript versions it writes out the version tag. It's then just a matter of opening the script in each browser version and seeing what it reports. I don't use MultipleIEs for this sort of testing but instead run a proper install of each version of Internet Explorer in its own VMWare Virtual Machine.

<script language="javascript">
document.write("javascript<br />");
</script>

<script language="javascript1.0">
document.write("javascript1.0<br />");
</script>

<script language="javascript1.1">
document.write("javascript1.1<br />");
</script>

<script language="javascript1.2">
document.write("javascript1.2<br />");
</script>

<script language="javascript1.3">
document.write("javascript1.3<br />");
</script>

<script language="javascript1.4">
document.write("javascript1.4<br />");
</script>
<script language="javascript1.5">
document.write("javascript1.5<br />");
</script>

<script language="jscript">
document.write("jscript<br />");
</script>

<script language="ecmascript">
document.write("ecmascript<br />");
</script>

Results

Internet Explorer 8beta1, 7, 6, 5.5, 5 on Windows all reported that they support the following version tags. I don't have access to a Mac to be able to test the older versions of IE on a Mac, nor a Virtual Machine with an install for IE4 so have not been able to include them in my tests.

  • javascript
  • javascript1.1
  • javascript1.2
  • javascript1.3
  • jscript
  • ecmascript

Firefox 3.0beta5, 2.0, 1.5, 1.0 all reported the support the following version tags:

  • javascript
  • javascript1.0
  • javascript1.1
  • javascript1.2
  • javascript1.3
  • javascript1.4
  • javascript1.5

Konqueror 3.5 reported the following version tags:

  • javascript
  • javascript1.0
  • javascript1.1
  • javascript1.2
  • javascript1.3
  • javascript1.4
  • javascript1.5
  • jscript
  • ecmascript

Safari: I don't have a Mac so cannot test this script on any versions of Safari. (Well that's not quite true - I have an old Mac iBook but the hard drive seems to be broken so I can't use it for testing any more). However, Safari 3.1 on Windows reports the following version tags (all of them, the same as for Konqueror):

  • javascript
  • javascript1.0
  • javascript1.1
  • javascript1.2
  • javascript1.3
  • javascript1.4
  • javascript1.5
  • jscript
  • ecmascript

Opera versions 7.54 through 9.0 on Windows reported all of them, and Opera 7.0 on Windows all of them except for 1.5 

  • javascript
  • javascript1.0
  • javascript1.1
  • javascript1.2
  • javascript1.3
  • javascript1.4
  • javascript1.5
  • jscript
  • ecmascript

Conclusion

Internet Explorer will execute code between Javascript tags up to javascript1.3 (but not for javascript1.0) whereas all the other major modern browsers will also excute code flagged as version 1.4 or 1.5. If you wanted to run some code in those other browsers but not in Internet Explorer you could use the 1.4 or 1.5 tags for this purpose but it's not guaranteed to work in the future. And you're more than likely to want to still run that code in IE6+ anyway. While an interesting test to find out what versions the browsers say they support it's not been necessarily all that useful. It would probably be better to use Internet Explorer's conditional tags instead.

Comments

blog comments powered by Disqus