JavaScript

IE hack

There was a little hack that I used to detect internet explore using JavaScript. I don't know if I should say "Too bad" it doesn't work as well anymore. Lately the Internet Explorer team has be working tirelessly to keep up with other browsers. In my opinion, IE is now a great browser. It is fast, stable, secure and is just as good as any other.

The problem is that they have a big baggage. According to wikipedia, IE6 still have 3.81% Market share. And Microsoft is addicted to supporting Legacy systems. Now that we know that some old browsers from the stone age are still being used, how do you detect them?

When I first wrote a post about how to detect internet explorer, I showed a little trick that I found facinating.

var IE = (!+"v1")?true:false; // true only in IE

This statement, returns true only if it was IE. Now, it looks like it only returns true if it is IE 8 or less. Still useful I must say. Chances are all the code you write for firfox and chrome should work just fine in IE 9 and above. So you will only have problems with earlier versions.

I cannot find the original author of this hack, but I sure am grateful.


Comments

There are no comments added yet.

Let's hear your thoughts

For my eyes only