Google Answers Logo
View Question
 
Q: Apple Safari BrowserDetect and Alert Message ( Answered 5 out of 5 stars,   0 Comments )
Question  
Subject: Apple Safari BrowserDetect and Alert Message
Category: Computers > Programming
Asked by: binarian-ga
List Price: $2.00
Posted: 06 Dec 2003 12:32 PST
Expires: 05 Jan 2004 12:32 PST
Question ID: 284194
i need something that will simply detect that a browser is Apples
Safari browser and if so it will redirect to another page.
Answer  
Subject: Re: Apple Safari BrowserDetect and Alert Message
Answered By: juggler-ga on 06 Dec 2003 13:13 PST
Rated:5 out of 5 stars
 
Hello.

Here's an idea:

var isSafari=navigator.userAgent.toLowerCase().indexOf("safari")!=-1;
if(isSafari){location="safariPage.html"}

source: newsgroup message, archived by Google Groups:
http://groups.google.com/groups?q=%22detect+safari%22&hl=en&lr=&ie=UTF-8&selm=3E382BD6.CBD6DD61%40gerrytimlin.com&rnum=1

Here the page where the Safari use is redirected is called
safariPage.html, but you can call it anything you want.

I'm a Mac user, so I personally tested this by putting it into the
head of an html file. For example:
 
<head>
<script language=JavaScript>
var isSafari=navigator.userAgent.toLowerCase().indexOf("safari")!=-1;
if(isSafari){location="safariPage.html"}
</script>
</head>


I then tested it with Safari and other browsers.  When viewed with
Safari, it did indeed redirect to me to the other page.

--------

search strategy:
google groups: "detect safari"

I hope this helps.

Clarification of Answer by juggler-ga on 06 Dec 2003 13:14 PST
Sorry for that typo:

"Here the page where the Safari USER... "
binarian-ga rated this answer:5 out of 5 stars

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy