Created
January 8, 2022 03:36
-
-
Save leonsilicon/a09930938dfa218add994197c0eb0731 to your computer and use it in GitHub Desktop.
Redirect Internet Explorer users to modern browser
This file contains 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 lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<link rel="icon" href="/favicon.ico" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
</head> | |
<body> | |
<div id="app"></div> | |
<script type="module" src="/src/main.ts"></script> | |
<script> | |
// https://stackoverflow.com/questions/63404573/how-to-redirect-from-internet-explorer-to-microsoft-edge-seamlessly | |
// Redirects user to Microsoft Edge if they're on Internet Explorer | |
if (/MSIE \d|Trident.*rv:/.test(navigator.userAgent)) { | |
window.location = 'microsoft-edge:' + window.location; | |
setTimeout(function () { | |
// If the redirection failed, redirect the user to a Microsoft Help Page informing | |
// them that their browser is not supported. | |
window.location = 'https://go.microsoft.com/fwlink/?linkid=2135547'; | |
}, 1); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment