• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can I determine the browser for CSS purposes

 
Wilson Mui
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to determine what broswer the client is running then inmport the appropriate .css file. How can I do that. Can I start a script before I do the <style> header?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
read this:
http://www.thesitewizard.com/css/excludecss.shtml
I have never done this...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64715
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'd be better off making this decision in server-side code if that's a possibility for you.
 
Wilson Mui
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That would be a negative. At least for now.
 
Yuriy Fuksenko
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have not tried that, but I am pretty sure you could do something like:
<script>
if(document.all){
document.writeln("<style>........</style>");
}
else{
document.writeln("<style>........</style>");
}
</script>
 
Gjorgi Var
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or Wilson could try this:

Don't forget the last curly brace...
Buena suerte
 
Gjorgi Var
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
... and almost forgot this: try to avoid loading different css according to user's browser or choice since you'll not be treated well by search engines...
Hasta ma�ana
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Gjorgi Var:
... and almost forgot this: try to avoid loading different css according to user's browser or choice since you'll not be treated well by search engines...
Hasta ma�ana

Do you have proof of this???
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic