A good link explaining why browser sniffing is bad
Sometimes I visit a website with Chrome and get a message that I need to use one of the supported browsers to access the site. It really pisses me off (latest one: http://www.retailroadshow.com).
Anyone knows a link that explains why it is bad and what is the correct way to handle those things? I want to send it to 开发者_如何学编程them ...
Thanks
This looks like a duplicate question to the following:
Browser detection versus feature detection
There are arguments for edge cases where browser detection is appropriate, generally when used for internal applications where the app is built around a particular browser, or when feature detection is difficult or the browser implements the feature incorrectly.
One of the links present in the question above points to Mozilla's developer site, giving some cases for browser detection, pitfalls to avoid, and tips for doing it correctly.
https://developer.mozilla.org/en/Browser_Detection_and_Cross_Browser_Support
Browser Detection: Necessary or Negligent?
Discusses "feature testing" versus "browser sniffing".
This has some good case studies on the cons of browser sniffing, in the context of Javascript.
http://www.quirksmode.org/js/support.html
I think that browser sniffing is fine when it enforces you not to use too old browsers (especially IE6). Someone has to enforce that so that internet can move forward. This particular side's check is extremely stupid and outdated, just take a look what they suggest:
- Microsoft Internet Explorer 5.5 or higher
- Mozilla Firefox 1.0 or higher
- Netscape Browser 7.0 or higher
- Safari 1.2 or higher for Macintosh
And the must for browser check is ability to use site as is.
Just do not use their services if they are unable to respect potential clients.
Here's a good example. Basically the example is about a newer version of the browser fixing the issue that required browser specific processing. For this reason it is better to determine if the bug is going to happen regardless of which browser is used rather than do your specific processing based on the browser - “detect the bug, not the browser”.
精彩评论