What is the preferred way of loading browser-specific CSS files?
Posted
by Yuval A
on Stack Overflow
See other posts from Stack Overflow
or by Yuval A
Published on 2010-04-05T18:19:48Z
Indexed on
2010/04/05
18:23 UTC
Read the original article
Hit count: 226
What is the best way to handle browser-specific CSS file loading? Assume you are running in the context of a proper MVC framework.
Here are some options, you are free to discuss the pros and cons of these options as well as any other methods you know of, and prefer:
- Server-side solution: use the controller (e.g. servlet) to analyze the
user-agent
header in the request and return the proper CSS file in the view. - Use browser specific hacks to load files, such as:
<!--[if IE]> ... <![endif]-->
- Load CSS files asynchronously in client side by inspecting user-agent and adding respective files
- Use a client side framework to handle browser-specifics (such as jQuery browser-specific css rules)
© Stack Overflow or respective owner