开发者

Is it not good to detect devices, operating systems and browsers Versions by User-agents?

开发者 https://www.devze.com 2023-02-13 10:12 出处:网络
Is it not good to detect devices, oper开发者_Python百科ating systems and browsers Versions by User-agents?

Is it not good to detect devices, oper开发者_Python百科ating systems and browsers Versions by User-agents?

Can it create any problem in caching like if we set expire headers and use wordpress W3 Total cache plugin


Detecting browser version, especially via user agent strings, is a very bad idea. Amongst other things, this approach often fails with new versions of opera and chrome that are now in version 10+ because of the double digit version number.

It's better practice, and more informative, to instead use feature detection. Which will often often give you the information you're trying to determine.

Have a look at the Modernizr library by Paul Irish (of jQuery and Chrome) and others. Mix this with some of the techniques from the HTML5Boilerplate will generally suite all your needs, whilst being cross browser compatible.

You can also use CSS3 @media-queries for adjusting your site to mobile or small screen devices.

0

精彩评论

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