Bernard Savonet
asked on
Javascript test for Mozilla Firefox or Microsoft Internet Explorer IE
This is probably a great classic... but I can't find where it is here...
Working with javascript, I need to know if the page is running under Internet Explorer or Firefox: I will then load scripts and libraries accordingly.
It is just some dumb debugging code that will differ between versions, I do not need a 200% bulletproff solution
Working with javascript, I need to know if the page is running under Internet Explorer or Firefox: I will then load scripts and libraries accordingly.
It is just some dumb debugging code that will differ between versions, I do not need a 200% bulletproff solution
ASKER
Thx, I know, I do.
But I really want to run a single program that will behave differently
But I really want to run a single program that will behave differently
>>But I really want to run a single program that will behave differently
Don't understand
Don't understand
are you looking for something like this?
http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
Usually you can check certain javascript element properties in your script to see if they exist which allows you to determine which methods/properties to use, instead of doing actual browser sniffing from the get go, which can unreliable when new versions are released
http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
Usually you can check certain javascript element properties in your script to see if they exist which allows you to determine which methods/properties to use, instead of doing actual browser sniffing from the get go, which can unreliable when new versions are released
ASKER
in my case, I just want to test if
var fso = new ActiveXObject('Scripting.F ileSystemO bject');
is possible, which would allow me (under IE) to write some debug information to a file.
(Under Firefox, this just explodes but I can use more powerful debugging tools).
I simply don't want to edit 1 jd file an 1 html file every time I switch browser while debugging.
I have been trying to test if 'ActiveXObject' exists, but my test, most probably badly written, did fail.
var fso = new ActiveXObject('Scripting.F
is possible, which would allow me (under IE) to write some debug information to a file.
(Under Firefox, this just explodes but I can use more powerful debugging tools).
I simply don't want to edit 1 jd file an 1 html file every time I switch browser while debugging.
I have been trying to test if 'ActiveXObject' exists, but my test, most probably badly written, did fail.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great, exactly the simple solution I was looking for. Thx
Glad I could help and apologies in failing to understand your question earlier.
hongjun
hongjun
hongjun