Questione importante

Jack Michaelson's picture

He has: 1,733 posts

Joined: Dec 1999

If I have a script that checks the user's browser, version screenwidth and platform, how can I use different external CSS-files depending what the script returns.

Other words:
If browser is NS and OS is Mac-->use file1.css
If browser is NS and OS is Windows-->use file2.css
If browser is IE--> use file3.css
etcetera.

Thanx in advanx

Shakespeare: onclick || !(onclick)

detox's picture

They have: 571 posts

Joined: Feb 2001

Without having posted the code your referring to I am flying a bit in the dark. Anyway, here is a simple one I wrote a while back, just edit it to fit your browser variables:

<script type="text/javascript" language="JavaScript">

-1;
bIsIE = sAgent.indexOf("MSIE") > -1;
bIsIE4 = sAgent.indexOf("IE 4") > -1;
bIsIE5 = sAgent.indexOf("IE 5") > -1;
bIsNav = sAgent.indexOf("Mozilla") > -1 && !bIsIE;
bDoesAll = (bIsIE4 || bIsIE5) && !bIsMac;

if (bDoesAll)
{
document.write("");
}
else
{
document.write("");
}

//-->
</script>

Jack Michaelson's picture

He has: 1,733 posts

Joined: Dec 1999

thanx!

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.