How do you find out what version of JavaScript your browser supports?

W

wylbur37

How do you find out what version of JavaScript your browser supports?
Is there a JavaScript function that will tell you?



__________________________________
Do you Yahoo!?
Find out what made the Top Yahoo! Searches of 2003
http://search.yahoo.com/top2003
 
L

Lasse Reichstein Nielsen

wylbur37 said:
How do you find out what version of JavaScript your browser supports?

You don't.

Technically, only Netscape's browsers supports a "version of
JavaScript", since they are the ones defining the JavaScript
versions. The versions are summarized here:
<URL:http://devedge.netscape.com/library/manuals/2000/javascript/1.5/reference/preface.html#1003515>

Microsoft browsers have different versions of JScript, which is mostly
compatible with Netscape's JavaScript. They use their own version
numbers.
<URL:http://msdn.microsoft.com/library/en-us/script56/html/js56jsoriversioninformation.asp>

Other browsers implement their version of ECMAScript + DOM and call it
Javascript, e.g., Opera. They have no version numbers for the Javascript,
it just evolves with the browser.


The core language is pretty fixed by now, as everybody are
implementing ECMAScript v3. The differences are in the interface to
the browser and document, i.e., the DOM.
Is there a JavaScript function that will tell you?

No.

/L
 
P

Philip Herlihy

It's worth looking at the version info in the property sheet for
C:\WINDOWS\SYSTEM32/jscript.dll
 
F

Fabian

wylbur37 hu kiteb:
How do you find out what version of JavaScript your browser supports?
Is there a JavaScript function that will tell you?

The best approach is to test within your script for the presence of the
fucntion you want to use, rather than testing for a version number. In
other words, test for what it can do, rather than for what it says it
can do.
 
H

Holden Caulfield

I agree that doing object detection is usually better than using
version detection.

However, in answer to the original question, you could declare a
variable and then test for increasing versions of javascript such as
this:

<script language="javascript1.1">
<!--
var jsver = 1.1
// -->
</script>
<script language="javascript1.2">
<!--
jsver = 1.2
// -->
</script>
[and on and on until Nth version of javascript...]

Whatever "jsver" is at the end is your highest version CLAIMED to be
understood.

Holden
 
T

Thomas 'PointedEars' Lahn

Holden said:
I agree that doing object detection is usually better than using
version detection.

You bet! http://pointedears.de.vu/scripts/test/whatami
However, in answer to the original question, you could declare a
variable and then test for increasing versions of javascript such as
this:

<script language="javascript1.1">
<!--
var jsver = 1.1
// -->
</script>
<script language="javascript1.2">
<!--
jsver = 1.2
// -->
</script>
[and on and on until Nth version of javascript...]

Whatever "jsver" is at the end is your highest version CLAIMED to be
understood.

I have misguidedly used that years ago. And now -- what should it be
good for if not reliable? It is exactly the wrong way and thus returns
the wrong results. For example, IE 6.0 SP-1 on Win2k claims to support
JavaScript 1.5 but it does not support (not even with updated JScript
engine) core features specified there and in ECMAScript 3. Besides, the
above is invalid HTML 4 as the type attribute is missing, and it will
not validate as HTML 4.01/XHTML 1.0 Strict as the "language" attribute
is deprecated. OTOH, it is unlikely that you get a result even near to
truth if you use both the "language" and the "type" attribute.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top