RedRobotHero
Technical User
So I'm inexperienced in javascript and I'm looking at an example script. This is what it used to detect the browser. I don't know that I fully understand what it is doing.
Now, I guess the first line is testing whether certain objects exist, which is all well and good. The second line, though, seems to assume that anything that isn't Opera is IE. While that might work for a good portion of the time, there will be exceptions to that rule.
Is this fine the way it is? Or could there be problems with it?
Code:
var ns6=document.getElementById&&!document.all
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
Now, I guess the first line is testing whether certain objects exist, which is all well and good. The second line, though, seems to assume that anything that isn't Opera is IE. While that might work for a good portion of the time, there will be exceptions to that rule.
Is this fine the way it is? Or could there be problems with it?