Need help regarding Apple's Safari javascript.

RPS

Registered
Ok first of all, I don't know much about html, let alone other languages. So bare with me. Okay a couple of months ago, Apple.com added a script to their site which would let Safari-browsers (safari is a mac browser) see a pic with "Welcome Safari user!" on it. Anyway, I got a Mac download site running, but it doesn't work too well in IE, only in Safari it looks great. So now I want to have IE users see a pic with a message to use Safari or whatever.
Well here's the script:

PHP:
<SCRIPT_LANGUAGE_ =_ "JavaScript" >

____________var_ SafariMessage_ =_ "<IMG SRC=\"/home/images/2003/01/safarititle01202003.gif\" WIDTH=\"670\" HEIGHT=\"80\" ALT=\"WELCOME SAFARI USERS. The new PowerBooks.\">" 

____________ var_ NoSafariMessage_ =_ "<IMG SRC=\"/home/images/2003/01/powerbooktitle01202003.gif\" WIDTH=\"670\" HEIGHT=\"80\" ALT=\"The new PowerBooks.\">" 

____________ 

____________ if_( navigator .userAgent .indexOf ('Safari' )_!=_- 1)_{ 

________________ document .write (SafariMessage ); 

____________}_else_{ 

________________ document .write (NoSafariMessage ); 

____________} 

____________ </SCRIPT>

This looks like PHP, right? Well it says JavaScript. Anyway, how exactly do I add this script to my html site?:confused:
 
Code:
<script language="javascript">

<!--
var SafariMessage = "<IMG SRC=\"/home/images/2003/01/safarititle01202003.gif\" WIDTH=\"670\" HEIGHT=\"80\" ALT=\"WELCOME SAFARI USERS. The new PowerBooks.\">"
var NoSafariMessage = "<IMG SRC=\"/home/images/2003/01/powerbooktitle01202003.gif\" WIDTH=\"670\" HEIGHT=\"80\" ALT=\"The new PowerBooks.\">"

if (navigator.userAgent.indexOf('Safari') != -1) {
document.write(SafariMessage);
} else {
document.write(NoSafariMessage);
}

-->

</script>
 
"doesn't work" isn't helpful. What's happening on IE?

This is very straight-forward Javascript. No reasons on earth it shouldn't operate on any Javascript-enablde browser.

bear
 
Back
Top