-
-
Save rmetzler/537764 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
From: http://devoracles.com/the-best-method-to-check-for-internet-explorer-in-javascript | |
"I declared a new variable, called IE, which has the value a comment block followed by ‘false‘. | |
The above variable will be understood by IE: var IE = !false, because Internet Explorer uses | |
JScript — a Javascript-like dialect of the standard ECMAScript — instead of Javascript which is | |
used by all the other browsers. JScript can parse the comments, just like Internet Explorer (see | |
conditional HTML comments post). This is a unique feature of IE, none of the other browsers can do it, | |
so Firefox, Chrome, Safari, Opera, all will understand the above declaration as IE = false." | |
*/ | |
var IE = /*@cc_on!@*/false; | |
if (IE) { | |
// do things for IE | |
} | |
else { | |
// do things for other browsers | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment