Detect Browser and Redirect

Hi All, I have a script which redirects if the browser is IE, does anyone know how to include Safari in the redirection? I have tried a couple of things but I can’t seem to crack this one.

<script>if (/*@cc_on!@*/false || (!!window.MSInputMethodContext && !!document.documentMode)) {window.location.href="../error/noSA.php";}</script>

Thanks in Advance

Not sure how to fit this into the code you showed us, but, here is a routine that I found on S.O. that looks like
it might work.

var ua = navigator.userAgent.toLowerCase(); 
if (ua.indexOf('safari') != -1) { 
  if (ua.indexOf('chrome') > -1) {
    alert("1") // Chrome
  } else {
    alert("2") // Safari
  }
}

So, something like this might do it: navigator.userAgent.toLowerCase().indexOf(‘chrome’)

Sponsor our Newsletter | Privacy Policy | Terms of Service