Skip to content

Instantly share code, notes, and snippets.

@hyunbinseo
Last active June 16, 2022 08:40
Show Gist options
  • Save hyunbinseo/8031fc3869ce4353f9027cb2e4831279 to your computer and use it in GitHub Desktop.
Save hyunbinseo/8031fc3869ce4353f9027cb2e4831279 to your computer and use it in GitHub Desktop.
Unsupported browser page for Internet Explorer
<!DOCTYPE html>
<html lang="en">
<head>
<script>
// Check if the client is Internet Explorer.
if (/MSIE|Trident/.test(window.navigator.userAgent))
// In Cloudflare Pages trim .html from the URL
// It is not supported in older versions of IE
// Can be reproduced in version 11.0.9600.18860
location.href = 'path-to-unsupported.html';
</script>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body onload="openInEdge()">
<script>
function openInEdge() {
if (/MSIE|Trident/.test(window.navigator.userAgent)) {
// Client is Internet Explorer. Ask for redirect.
if (window.confirm("Open page in Microsoft Edge?")) {
window.location.href =
// Open the link in Microsoft Edge (if available)
'microsoft-edge:'
+ window.location.origin;
}
} else {
// Client is not Internet Explorer. Redirect on load.
window.location.href = window.location.origin;
}
}
</script>
<h1>Unsupported Browser</h1>
<p>This page should not be opened in
<a href="https://www.microsoft.com/en-us/edge/business/ie-mode">
Edge Internet Explorer (IE) mode.
</a>
</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment