Joined: 10 Jan 2005 Posts: 46 Location: Rosario - Argentina
Posted: Wed Jun 24, 2009 5:53 pm Detecting Browser and Loading CSS
Hi there, I've been using a javascript for a long time now, that loads a different css if the user has Internet Explorer 6...
The thing is that I now want to load different things in many other cases, I would need:
- Internet Explorer 6 or below
- Internet Explorer 7 or above
- Firefox
- Safari
Any idea on how to tweak my code to make it work?
Here it is:
Code:
<script type="text/javascript">
// Function to include the css
function includeCSS(src) {
document.write('<link rel="stylesheet" type="text/css" href="'+src+'">');
}
//If it's not IE it returns 0
if((version>=6.0) && (version<7.0)){
// Case IE6
includeCSS("css/leftIE6.css");
}
else{
// All the other cases
includeCSS("css/left.css");
}
</script>
And here's some info that I can't work around to make it work:
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum