script language attribute / JavaScript version

published on
July 24th, 2007
by fry

There used to be a very nice attribute to the script tag that defined what version of JavaScript is present between the script tags. You’d say language=”JavaScript1.3″ and older browsers that only supported JavaScript 1.2 wouldn’t run the code. Unfortunately this is not the case anymore - the attribute has been deprecated and browsers don’t really support it anymore. IE says that JS 1.3 is the latest version it supports, Firefox and Safari support 1.7. Opera supports 1.5 and surprisingly all the 2.x version (huh?) and the browser in Blackberry (the reason for testing this) supports everything.

I know - search for what you need, but in this case I don’t really want to check for all the objects and methods that I need…

Check your own browsers JavaScript support.

Opinions

  1. posted on
    July 25th, 2007
    by steve

    yeah, this was a nice idea at the time, but since MSIE’s “version” of IE differed greatly from the *real* version of JavaScript, this attribute was useless.

    You’re better off, to do some very minor browser sniffing, then cater your code where req’d to a particular browser.

    e.g. if you are trying to set the style attribute via DOM methods… add logic that if the browser is IE, to set the ‘cssText’ attribute instead (since IE doesn’t follow the spec here)

  2. posted on
    July 25th, 2007
    by Arjsn Eising

    Why testing on JavaScript version? It is better to test if a method or object is present, and then use it.

  3. posted on
    July 26th, 2007
    by ego

    The idea of testing for methods is good when you’re sure what your baseline is. The problem is that with mobile devices you’re never sure what the baseline is.

    A very nice example is Blackberry (7290 I think) that supports JavaScript but you can’t really know what version/metods - some scripts just don’t work. And I don’t really wish to check for everything I need in a script…

Express your opinion

My name is Marko Mrdjenovič and I’m a web developer and a manager from Ljubljana, Slovenia (N 46° 03.246,W 14° 30.265).

I work at Zemanta, I’m a WaSP ILG member and I’m also the program lead at local weekly talks Spletne urice / www:h.

Blog archive

Advertisments

Jobs

Come in, we're hiring

Full-time and freelance job opportunities available at Authentic Jobs:

  • Loading ...

Post a job and reach web professionals everywhere.