Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-29-2004, 02:14 PM   PM User | #1
finstah1
Regular Coder

 
Join Date: May 2004
Location: The First State
Posts: 233
Thanks: 9
Thanked 0 Times in 0 Posts
finstah1 is an unknown quantity at this point
navigator.userAgent syntax

hey all,

I'm using this javascript to send a particular style sheet based on browser.

Code:
if (navigator.userAgent.indexOf("AOL") != -1) {
	document.write("<link rel='stylesheet' href='" + css_AOL + "' type='text/css'>");
		}
	else {
document.write("<link rel='stylesheet' href='" + css_other + "' type='text/css'>");
}
My question is can I use the following to also include Mozilla 4.0?

Code:
if ((navigator.userAgent.indexOf("AOL")!=-1)
||(navigator.userAgent.indexOf("Mozilla/4")!=-1)) {
	document.write("<link rel='stylesheet' href='" + css_AOL + "' type='text/css'>");
		}
	else {
document.write("<link rel='stylesheet' href='" + css_other + "' type='text/css'>");
}
thanks in advance
finstah

Last edited by finstah1; 06-29-2004 at 02:25 PM..
finstah1 is offline   Reply With Quote
Old 06-30-2004, 08:08 PM   PM User | #2
Roy Sinclair
Senior Coder

 
Join Date: Jun 2002
Location: Wichita
Posts: 3,880
Thanks: 0
Thanked 0 Times in 0 Posts
Roy Sinclair will become famous soon enough
No reason why it shouldn't be possible. Have you tried it?
__________________
Check out the Forum Search. It's the short path to getting great results from this forum.
Roy Sinclair is offline   Reply With Quote
Old 07-01-2004, 03:16 PM   PM User | #3
finstah1
Regular Coder

 
Join Date: May 2004
Location: The First State
Posts: 233
Thanks: 9
Thanked 0 Times in 0 Posts
finstah1 is an unknown quantity at this point
it worked. I just wanted to make sure I had the syntax correct.
finstah1 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:34 AM.


Advertisement
Log in to turn off these ads.