开发者

sniffing browsers in a post sniff world, can I still use jquery.browser?

Post Sniffing Rules

Although browser sniffing used to be quite popular, it's now gone out of 开发者_如何学运维fashion (for good reasons) and has been deprecated (if not dropped) by popular libraries such as jquery.

The better way is to do feature detection.

Exception To The New Rule

However, there are times when you might be targeting (for whatever reason) a specific browser. iOS safari is a good example, as are other mobile browsers, as the mobile platform has different ui concerns.

My Particular Purpose

For my purposes, I want to target IE specifically in order to alert the user to use another browser.

You may not agree with what I want to do, but please disregard that in your answer.

With this in mind, what the best, most reliable way to detect browser versions, more specifically any IE version, and iOS Safari too.

Is it safe to still use jquery.browser?


Use Conditional Comments. The are a perfect fit for what you're after.


Also, it's all very well and good to tell people to use feature detection but in the real world, when you have 3 days to update the browser detection on your company's website you can't go and re-write all the Javascript just to take advantage of this, so I say, heck yes, use browser sniffing, because sometimes you don't have a choice.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜