File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes How can I determine the browser for CSS purposes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How can I determine the browser for CSS purposes" Watch "How can I determine the browser for CSS purposes" New topic
Author

How can I determine the browser for CSS purposes

Wilson Mui
Ranch Hand

Joined: Apr 09, 2003
Posts: 140
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
read this:
http://www.thesitewizard.com/css/excludecss.shtml
I have never done this...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60055
    
  65

You'd be better off making this decision in server-side code if that's a possibility for you.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Wilson Mui
Ranch Hand

Joined: Apr 09, 2003
Posts: 140
That would be a negative. At least for now.
Yuriy Fuksenko
Ranch Hand

Joined: Feb 02, 2001
Posts: 413
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

Joined: Feb 24, 2004
Posts: 85
Or Wilson could try this:

Don't forget the last curly brace...
Buena suerte
Gjorgi Var
Ranch Hand

Joined: Feb 24, 2004
Posts: 85
... 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

Joined: Nov 08, 2001
Posts: 15376
    
    6
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???
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I determine the browser for CSS purposes
 
Similar Threads
Determing parameters of a service
Find web application root path?
Nested css?
JSP / CSS
How to determine CSS version used for a page?