Last active
January 15, 2018 05:48
-
-
Save samuels410/f1efa03b84c3b268da462c1cf3206327 to your computer and use it in GitHub Desktop.
Js script to identify chrome browser and show an alert
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
(function () { | |
var chrome = { | |
string: navigator.userAgent.match(/Chrome\/(\d+)/) | |
}; | |
chrome.version = chrome.string ? parseInt(chrome.string[1], 10) : null; | |
currentUrl = window.location.href; | |
Domain = "https://domain"; | |
yDomainWithoutSSL = "http://domain"; | |
if ((!chrome.string) && (currentUrl === Domain || currentUrl === DomainWithoutSSL)) { | |
alert("For best results, Website requires using the Chrome browser. Please close and open using Chrome."); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment