Hi,
How come it's not common (as far as I'm concerned) to make a server-side browser detection script decide which CSS-file to include in cross-browser designs?
As I can see, it would be much cleaner than all the CSS-hacks that's beeing used, or am I mistaken?
Is there a point I'm missing?
/asger
Why not serverside browser detection?
Moderator: General Moderators
-
asgerhallas
- Forum Commoner
- Posts: 80
- Joined: Tue Mar 14, 2006 11:11 am
- Location: Århus, Denmark
Re: Why not serverside browser detection?
Lets split the issue into the "Theory", and the "Reality".asgerhallas wrote:Hi,
How come it's not common (as far as I'm concerned) to make a server-side browser detection script decide which CSS-file to include in cross-browser designs?
As I can see, it would be much cleaner than all the CSS-hacks that's beeing used, or am I mistaken?
Is there a point I'm missing?
/asger
In Theory:
- Working around a browser is non-ideal, so don't do that.
- You can make wonderful cross-browser designs without any hacks
- You should only need "a few" hacks, so conditional comments should be good enough
In Reality:
- You have to work around the largest marketshare browser the most, so you have to do SOMETHING.
- Some nice designs require hacks.
- Some nice designs require LOTS of hacks.
So, you end up with what we have - a general rule that you should do conditional comments, and minor exceptions to the rule where you do server-side to provide different css to different browsers.
Theres a bunch of reasons not to do server-siding:
- It encourages bad behavior. If you will use non-standard content ("Hacks") for IE, why should they change?
- It lies to search engines, giving them different information than you would give a user
- It adds more work to the webserver to serve what might be static content
- It adds more work for the developers, who have to maintain multiple css files instead of one
- It increases the number of http requests on a page, reducing the speed of that page
- Server-side browser detection is unreliable, and often flat out wrong (And users can lie easily)
All of which are "minor" in the right situation, so they can be ignored - in the right situation. The general rule, however, is to go with conditional comments.
-
asgerhallas
- Forum Commoner
- Posts: 80
- Joined: Tue Mar 14, 2006 11:11 am
- Location: Århus, Denmark