This is a horrible, horrible idea IMO. I can understand the sentiment, but this is going to do as much good, and raise as much sympathy, as sites with "Stop using IE, moron!" messages. But it's up to you....
Quirksmode has a small BrowserDetect library that I trust has all the quirks worked out. If I were you, I would use that.
To do it in one line, look for Safari
in the navigator.userAgent
string.
Example code:
if (navigator.userAgent.indexOf('Safari/') != -1){
alert("Safari detected");
}
If you want to make 100% sure you catch them all (well, 99% bearing in mind the user agent string can be changed freely by the client), you'd need to use a server-side language like PHP.
if (strstr($_SERVER["HTTP_USER_AGENT"], "Safari"))
{
header("location:no-safari.html");
die();
}