Created
September 23, 2016 16:00
-
-
Save ikonikre/a58a6f831d6f249f87781c5d742ab5bf to your computer and use it in GitHub Desktop.
Detect browser script.
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
<script> | |
var message = ''; | |
var ba = [ "Chrome", "Firefox", "Safari", "Opera", "MSIE", "Trident", "Edge" ]; | |
var b, ua = navigator.userAgent ; | |
for ( var i=0; i < ba.length; i++ ) { | |
if ( ua.indexOf(ba[i]) > -1 ) { | |
b = ba[i] ; | |
break ; | |
} | |
} | |
if ( b == 'MSIE' || b == 'Trident' ) { | |
b = 'Internet Explorer' ; | |
message = '<style>.bl{color:blue;text-decoration:underline;}</style><div class="container m-y-3 alert alert-info alert-dismissible fade in" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button><strong>' + b + '</strong> is not supported by this Web site due to its age and security flaws.<br /><span class="small">Switch to a modern browser, like <a class="bl" href="http://firefox.com">Firefox</a> or <a class="bl" href="http://google.com/chrome/">Chrome</a>, and try again. Otherwise this site may not function correctly and your personal information may be unnecessarily exposed to third-parties.</span></div>' ; | |
document.getElementById('browserAlert').innerHTML = message ; | |
} | |
</script> |
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
<span id="browserAlert"></span> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment