Welcome to WebmasterWorld Guest from 54.167.61.200

Forum Moderators: not2easy

Message Too Old, No Replies

Stylesheets on Mac and PC

     

Ayrenth

10:31 am on Aug 29, 2002 (gmt 0)

Inactive Member
Account Expired

 
 


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

11:51 am on Aug 29, 2002 (gmt 0)

Junior Member

10+ Year Member

joined:June 20, 2002
posts:115
votes: 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'>")
else
if (navigator.userAgent.indexOf("Win") > -1)
document.write("<link rel='stylesheet' href='winstyle.css'>")
else
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.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members