Stylesheets
breezy54
Status: New User - Welcome
Joined: 13 Feb 2010
Posts: 2
Reply Quote
I currently using the code below for stylesheets with Javascript Browser Detection Script. Does anyone have a more current up to date version?

<script type="text/javascript">
function browser_css() {
d = document;
if ( ie5mac ) {
d.write('<link rel="stylesheet" type="text\/css" href="/css/ie5mac.css">');
} else if (document.layers) {
d.write('<link rel="stylesheet" type="text\/css" href="/css/ns4x.css">');
} else if (ie4) {
d.write('<link rel="stylesheet" type="text\/css" href="/css/ie4.css">');
} else if (moz && (nu<1)) {
d.write('<link rel="stylesheet" type="text\/css" href="/css/moz_pre1-0.css">');
} else {
d.write('<link rel="stylesheet" type="text\/css" href="/css/moz5.css">');
}
}
</script>
Back to top
Can anyone help me?
breezy54
Status: New User - Welcome
Joined: 13 Feb 2010
Posts: 2
Reply Quote
I changed the code for the different browsers and OS and it works, But is there a way to have it detect windows ie8 separately?

Thanks for the help. It is appreciated.


<script type="text/javascript" src="browserDetection.js"></script>
<script type="text/javascript">
function browser_css() {
d = document;
if ( ie5xwin ) {
d.write('<link rel="stylesheet" type="text\/css" href="css/winieindex.css">');
} else if (document.layers) {
d.write('<link rel="stylesheet" type="text\/css" href="css/.css">');
} else if (moz && mac) {
d.write('<link rel="stylesheet" type="text\/css" href="css/macmozindex.css">');
} else if (moz && win) {
d.write('<link rel="stylesheet" type="text\/css" href="css/winmozindex.css">');
} else {
d.write('<link rel="stylesheet" type="text\/css" href="css/macindex.css">');
}
}
</script>
<script type="text/javascript">browser_css();</script>
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4127
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
ie 8 requires more advanced handling because of how the user agent is written, with its ie 7 emulation mode.

the full featured php browser detection script just got msie 8 support added, but that hasn't been ported to the javascript stuff yet, mostly because in my opinion it's not that great to use javascript for browser detection, but the changes will probably get ported to the js stuff at some point in the relatively near future.
Back to top
Display posts from previous:   

All times are GMT - 8 Hours