Last active
November 5, 2019 18:53
-
-
Save nicholasdunbar/9242264 to your computer and use it in GitHub Desktop.
Detect IE8 or a lesser version of IE in JavaScript.
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
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<title>Detect IE8</title> | |
<head> | |
<script type="text/javascript" id="init-ie-var"> | |
var isIE8OrLess = false; | |
</script> | |
<!--[if lte IE 8]> | |
<script type="text/javascript" id="set-ie-var"> | |
isIE8OrLess = true; | |
</script> | |
<![endif]--> | |
</head> | |
<body> | |
<script type="text/javascript" id="use-ie-var"> | |
if (isIE8OrLess){ | |
//is IE8 or a lesser version | |
} else { | |
//is not IE or a greater version of IE than IE8 | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment