Skip to content

Instantly share code, notes, and snippets.

@samuels410
Last active January 15, 2018 05:48
Show Gist options
  • Save samuels410/f1efa03b84c3b268da462c1cf3206327 to your computer and use it in GitHub Desktop.
Save samuels410/f1efa03b84c3b268da462c1cf3206327 to your computer and use it in GitHub Desktop.
Js script to identify chrome browser and show an alert
(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