Forum Moderators: open

Message Too Old, No Replies

Determine version of JavaScript that script adheres to?

         

JAB Creations

10:55 am on Oct 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



When I write a script I am rather curious if there is a tool I can run it against to have it tell me what the highest version of JavaScript it requires the browser to run it by. I know of course browsers won't always fully support the version of JavaScript they claim to support but I'm simply curious what versions of JavaScript I'm coding by.

- John

rocknbil

8:16 pm on Oct 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't know of one, but a bit of info that might help why you're asking - if you're concerned that it might not work, don't test for browsers or versions as those are always changing. Test for the object. For example,

if (document.getElementById) {
// do something
}

Will almost always fail in older browsers or browsers not supporting document.getElementById. So I don't need to jam up my JS with a bunch of ifs and else's for browsers, it works or I provide a non-JS solution. :-)

If I **had** to know this I'd probably examine my script and compare the methods against the various support of those methods in the JS documentation.