473,387 Members | 1,364 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

about detecting javascript version

hi, i was just wondering about javascript version
i used to do it putting in the <head>:

<script type="text/javascript">
jsver = "1.0";
</script>
<script language="JavaScript1.1">
jsver = "1.1";
</script>
<script language="JavaScript1.2">
jsver = "1.2";
</script>
<script language="JavaScript1.3">
jsver = "1.3";
</script>
<script language="JavaScript1.4">
jsver = "1.4";
</script>
<script language="JavaScript1.5">
jsver = "1.5";
</script>

and i got in the variable jsver the answer, but i dont think at all this is
a good method

Do you know a better way to do it??

Thanks
Jul 23 '05 #1
3 1711
On Fri, 24 Sep 2004 23:15:55 +0200, Ricardo Garcia wrote:
<script language="JavaScript1.1"> ... ..i dont think at all this is a good method
I agree.
Do you know a better way to do it??


It depends what 'it' is, but the answer is probably
'feature detection'.

Get the hang of feature detection, and you will cease to care
what version of JS the browser reports it is running.

HTH

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.lensescapes.com/ Images that escape the mundane
Jul 23 '05 #2
Ricardo Garcia wrote:
hi, i was just wondering about javascript version
i used to do it putting in the <head>:
<--snip-->
and i got in the variable jsver the answer, but i dont think at all this is
a good method

Do you know a better way to do it??


<script type="text/javascript">
if (condition){
//code to execute
}
</script>

Meaning, use the type attribute, forget the language attribute, and test
for what you want to use in an if statement.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #3
Ricardo Garcia wrote:
hi, i was just wondering about javascript version
i used to do it putting in the <head>:

<script type="text/javascript">
jsver = "1.0";
</script>
[...]
and i got in the variable jsver the answer, but i dont think at all this
is a good method
Correct. The first "script" element's content is processed by a JavaScript
1.5 engine and if the UA does not interpret the "JavaScript..." variants as
expected, the result will be a false one.
Do you know a better way to do it??


There is no (good) way to do it, use feature detection instead.
PointedEars
--
Experience is life's consolation prize.
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Andy | last post by:
got the usual script: <script language="JavaScript" type="text/JavaScript"> var s_height = screen.Height var s_width = screen.Width var s_screen= screen.colorDepth if ( s_height == "480" &&...
12
by: Wladimir Borsov | last post by:
On one of my web pages there is an java applets which works fine on my computer. However I noticed on some other computer that the run of java applets are disabled. I got an error message...
11
by: Dag Sunde | last post by:
We have this web-app that requires Javascript to be enabled in the UA (this is okay'ed by our customer). Now I want to make a "pre" page before the login screen, informing the user that he/she...
3
by: regtrashcan | last post by:
I have a webpage that detects whether Shockwave Player is installed and the version number. The javascript/vbscript that I use has worked fine until the latest release of the Shockwave Player. I am...
79
by: VK | last post by:
I wandering about the common proctice of some UA's producers to spoof the UA string to pretend to be another browser (most often IE). Shouldn't it be considered as a trademark violation of the...
7
by: Nathan Sokalski | last post by:
I want to make sure I am doing a browser detection that will work once IE7 is released. My current detection statement (written using VB.NET) is: If Me.Request.Browser.Browser.ToUpper() = "IE"...
3
by: Inger Eik | last post by:
I'm trying to help someone with this menu (which is part of a frameset): http://www.kepler.fr.bw.schule.de/menue.html The menu shows up fine in IE and FF, but not in Opera. Latest version is...
15
by: RobG | last post by:
When using createEvent, an eventType parameter must be provided as an argument. This can be one of those specified in DOM 2 or 3 Events, or it might be a proprietary eventType. My problem is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.