Skip to content

Instantly share code, notes, and snippets.

@haukurk
Last active August 29, 2015 14:09
Show Gist options
  • Save haukurk/0a4baae335bd93e3a3f7 to your computer and use it in GitHub Desktop.
Save haukurk/0a4baae335bd93e3a3f7 to your computer and use it in GitHub Desktop.
Check if darn IE compatibility mode is on...
<script type="text/javascript">
$(document).ready(function() {
// Fix placeholder for stupid IE8
$('input, textarea').placeholder();
var agentStr = navigator.userAgent;
var mode;
var isCompatON = false;
if (agentStr.indexOf("Trident/5.0") > -1) {
if (agentStr.indexOf("MSIE 7.0") > -1) {
mode = "IE9 Compatibility View";
isCompatON = true;
} else
mode = "IE9";
}
else if (agentStr.indexOf("Trident/4.0") > -1) {
if (agentStr.indexOf("MSIE 7.0") > -1) {
mode = "IE8 Compatibility View";
isCompatON = true;
} else
mode = "IE8";
}
else
mode = "IE7";
if (isCompatON) {
alert('This application does not work with IE Compatibility mode. \n Please disable before logging in.');
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment