homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

Stylesheets on Mac and PC

10+ Year Member

Msg#: 296 posted 10:31 am on Aug 29, 2002 (gmt 0)

we are in the process of developing a site that needs to be mac and pc based. Both are viewed in MSIE 5+.

My problems is that the mac version needs a different style sheet to that of the pc version. I am trying to set up and if statement looking for the different versions but my problem is linking the style sheet in the javascript if statement using the <link> tag

can anyone assist



10+ Year Member

Msg#: 296 posted 11:51 am on Aug 29, 2002 (gmt 0)

It is commonly done usign server-side scripting, but also possible with javascript:

if (navigator.userAgent.indexOf("Mac") > -1)
document.write("<link rel='stylesheet' href='macstyle.css'>")
if (navigator.userAgent.indexOf("Win") > -1)
document.write("<link rel='stylesheet' href='winstyle.css'>")
document.write("<link rel='stylesheet' href='nixstyle.css'>")

Place this in the <script> section of the <head> of your pages, or save it in external .js file and attach to all pages.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved