Im trying to figure out a way to tell it that if its using IE to use one script but if its useing any other browser to use a different script, I tried usuing regular if else statements but doesnt seem like java likes those
who knows javascript?
Collapse
X
-
if(navigator.AppName== 'Netscape') - it's netscape, seamonkey,firefox or whatever, otherwise it's 99% IE -
Use a server side script to write the .js include:
if($_SERVER["HTTP_USER_AGENT"] == "so and so")
echo "this.js";
else
echo "that.js";
Or, have your .js file alias to a server side script that does the same thing internally.
Otherwise, I tend to agree with Calvilnguy, that's it'd be better to just write cross-platform JS scripts.Your post count means nothing.Comment
-
-
are you sure you mean echo????Use a server side script to write the .js include:
if($_SERVER["HTTP_USER_AGENT"] == "so and so")
echo "this.js";
else
echo "that.js";
Or, have your .js file alias to a server side script that does the same thing internally.
Otherwise, I tend to agree with Calvilnguy, that's it'd be better to just write cross-platform JS scripts.
that's for writing shit in phpICQ# 143561781Comment
-
Comment
-
why not just put the 2 javascript together in one file in sep functions..
this would go in body tag or head tag
This would go inside detect.jsCode:<script src=detect.js></script> <script> var browser_type=navigator.appName var browser_version=parseInt(navigator.appVersion) //if IE 4+ if (browser_type=="Microsoft Internet Explorer"&&browser_version>=4){ document.write("- press any keyboard key to skip to the next picture -<br>"); ie(); } else { notie(); } </script>
Code:function ie() { alert('Your using internet explorer'); } function notie() { alert('Your not using internet explorer'); }hatisblack at yahoo.comComment
-
hi Pete,
Try this:
http://www.cdnetworx.com/detect.zip
basically, you put the code that is in example.html into the page you want the detection on. Put your firefox javascript into fire.js and your ie specific js into ie.js
should work ... if you have questions, my icq is 125-48-32-18
cheers ...Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.Comment
-
Comment

Comment