By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,946 Members | 1,600 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,946 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Jul 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
wylbur37 <wy************@yahoo.com> writes:
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
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2

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

--
######################
## PH, London ##
######################
Lasse Reichstein Nielsen wrote:
wylbur37 <wy************@yahoo.com> writes:
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/...pt/1.5/referen
ce/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...6jsoriversioni
nformation.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

Jul 20 '05 #3

P: n/a
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.
--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk

Jul 20 '05 #4

P: n/a
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
Jul 20 '05 #5

P: n/a
Holden Caulfield wrote:
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
Jul 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.