-2

Actually my HTML website is not compatible with safari browser so i want to make all the safari users ask to use Google chrome for better user interface experience. Please can anyone provide me the code or set of code that i can use. I need a HTML code, NOT PHP. Need Help !!

  • http://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser – surya singh Oct 03 '15 at 12:16
  • Do you even know what JavaScript is? Since you think all provided code is PHP? – Daan Oct 03 '15 at 12:35
  • I'm voting to close this question as off-topic because SO does not write code for you so you should not ask such questions here. – Rob Oct 03 '15 at 15:08

2 Answers2

1
if(navigator.userAgent.toLowerCase().indexOf('safari/') > -1) {
    window.alert("Please use Google Chrome for a better user interface experience on this website.");
}

since you believe the above code is PHP, you could also use this:

if(Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0) {
    window.alert("Please use Google Chrome for a better user interface experience on this website.");
}
Daan
  • 578
  • 7
  • 21
0

Try this...

var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
if (isSafari == true){
  alert('Please use Google chrome instead of Safari!');
}
Xahed Kamal
  • 2,203
  • 1
  • 20
  • 41