Last active
December 16, 2017 22:35
-
-
Save Graham42/b9db763d595455ed3650da9ac7deb63d to your computer and use it in GitHub Desktop.
refuse to serve IE - this is conditionally useful
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
<body> | |
<noscript> | |
<p>You need to enable JavaScript to run this app.</p> | |
</noscript> | |
<!-- Check for IE 9 and below --> | |
<!--[if IE]> | |
<p>Sorry! Your browser is not supported. We recommend using | |
<a href="https://www.google.com/chrome/browser/">Chrome</a> or | |
<a href="https://www.mozilla.org/en-US/firefox/new/">Firefox</a>. | |
</p> | |
<![endif]--> | |
<!-- Check for unsupported browsers that are not IE 9 and below --> | |
<!--[if !IE]><!--> | |
<script type="text/javascript"> | |
(function () { | |
// This is an estimate, pretty much all modern browsers support promises | |
var supported = | |
window.Promise !== undefined && | |
window.Promise !== null && | |
Object.prototype.toString.call(window.Promise.resolve()) === '[object Promise]'; | |
if (!supported) { | |
var root = document.getElementById('root'); | |
root.id = 'x'; | |
root.innerHTML = | |
'<p>Sorry! Your browser is not supported. We recommend using <a href="https://www.google.com/chrome/browser/">Chrome</a> or <a href="https://www.mozilla.org/en-US/firefox/new/">Firefox</a>.</p>'; | |
} | |
})(); | |
</script> | |
<!--<![endif]--> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This should not be used for websites. Websites should gracefully degrade.
However, for web apps this may be reasonable depending on your business case.