suppose this i a “beginner’s” question and the answer might be to really understand regex, BUT I don’t 🙂 right now i have a problem with different versions of firefox (in version 6 and previous, file.filename is the filereader method to get the name of a file, from version 7 on it is file.name).
so i actually test the follwing:
1. ((/firefox/i).test(navigator.userAgent)&&!(/rv:7/i).test(navigator.userAgent)&&!(/rv:8/i).test(navigator.userAgent)) ? 'Moz' :
2. ((/firefox/i).test(navigator.userAgent)&&(/rv:7/i).test(navigator.userAgent))? 'Moz7' :
3. ((/firefox/i).test(navigator.userAgent)&&(/rv:8/i).test(navigator.userAgent))? 'Moz8' :
which is not very effektive 🙂 i’d rather ask for “versions up to 6” and “versions from 7 up”. how could i change my way?
thanks for hints
Have a look at quirksmode – there is a long section on browser detection …. why re-invent the wheel …
http://www.quirksmode.org/js/detect.html
You can then use the output of that to perform
if (browser > versionx)type code …