Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Load CSS depending on platform!

Status
Not open for further replies.

Beat

Technical User
Aug 26, 2001
41
0
0
SE
Hi,
Have anyone got a simple script that detects the platform and then loads a certain CSS depending on what platform is has detected.

I have a script that detects the browser, IE or Netscape which has helped quite a lot. But this one appears different in IE on MAC and IE on PC so I would like to detect the platform.

If anyone got any opinions, experiences or idees regarding making website cross platformed in general Im interested to listen (or read...).

Thanks!
 
put this in the <head> of your document:
Code:
<script type="text/javascript">
var Win = (navigator.platform.indexOf("Win") > -1);
var Mac = (navigator.platform.indexOf("Mac") > -1);

if (Win) {
  document.write('<link rel="stylesheet" type="text/css" href="windows.css">');
}
else if (Mac) {
  document.write('<link rel="stylesheet" type="text/css" href="mac.css">');
}
</script>

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top