473,385 Members | 1,814 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,385 software developers and data experts.

How to run the JavaScript if above version?

E.g. I only want if my browser support JavaScript 1.9
<script type="text/javascript" language="JavaScript1.9">
alert("Hello");
</script>

Jul 3 '08 #1
5 1613
On Jul 2, 7:47 pm, howa <howac...@gmail.comwrote:
E.g. I only want if my browser support JavaScript 1.9

<script type="text/javascript" language="JavaScript1.9">
alert("Hello");
</script>
Why do you want to do that?

Peter
Jul 3 '08 #2
The above is just an example...

For example, if I want to take some advance features of JavaScript
version, I don't want older client to see the syntax error.
On 7$B7n(B3$BF|(B, $B>e8a(B11$B;~(B18$BJ,(B, Peter Michaux <petermich...@gmail.comwrote:
On Jul 2, 7:47 pm, howa <howac...@gmail.comwrote:
E.g. I only want if my browser support JavaScript 1.9
<script type="text/javascript" language="JavaScript1.9">
alert("Hello");
</script>

Why do you want to do that?

Peter
Jul 3 '08 #3
howa wrote:
E.g. I only want if my browser support JavaScript 1.9

<script type="text/javascript" language="JavaScript1.9">
alert("Hello");
</script>
JavaScript 1.9 -- that would be Firefox 4, would it not?

Anyhow, MDC explains how to do it for JavaScript 1.8 as
supported in Firefox 3:

<script type="application/javascript;version=1.8">
... your code ...
</script>

<http://developer.mozilla.org/en/docs/New_in_JavaScript_1.8>

And now your transfer effort, please.
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Jul 3 '08 #4
On Jul 3, 3:50*pm, Peter Michaux <petermich...@gmail.comwrote:
On Jul 2, 9:40 pm, RobG <rg...@iinet.net.auwrote:
[...]
Use standard feature detection and add the desired functionality to
UAs that lack it:
* if (typeof Array.prototype.reduce != 'function') {
* * // add your own reduce method
* }
Set your feature detection for say version 1.5 or maybe 1.3 and you
don't care what ECMAScript implementation is being used.

I'm not quite sure how that avoids syntax errors.
I think you misunderstood my point, which probably means it was poorly
stated. I meant do feature detection for features introduced after
1.5 or 1.3 as appropriate.
You could test for
features of the language that are in JavaScript 1.9. If those features
are present then only load script files that would other syntax error
in browsers missing JavaScript 1.9 support.
That might be called "language version inference". :-)
--
Rob
Jul 3 '08 #5
Peter Michaux wrote:
>>>howa wrote:
<script type="text/javascript" language="JavaScript1.9">
* * * * alert("Hello");
</script>
I don't know if there is a way to do what you want with some technique
like the "language" attribute for recent versions of JavaScript. I've
never bothered trying.
But my curiosity remains.
Maybe worth a glance:
http://bclary.com/2004/08/27/javascr...ompatibilities

The OP's idea should work in theory; but I think it's a bit reckless
to fully lean on the version as specified in the language-attribute.
For example, how would this relate to Microsoft's JScript (eg. my
MSIE7 only claims to support javascript up to 1.3.).

I would prefer the usual object detection as well.

--
Bart
Jul 4 '08 #6

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

Similar topics

5
by: Sue | last post by:
After finishing up my first quarter JavaScript on 12/12/03, I decided to improve character checking on my project. In my project I only had to do very basic validation. Therefore, I only had one...
8
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.