开发者

Php user-agent Graceful Degradation

开发者 https://www.devze.com 2023-02-03 08:20 出处:网络
I am looking to detect how modern the user\'s browser is.For example Google displays a table based gmail depending on the browser, and a table based layout for Google i开发者_StackOverflow中文版mages

I am looking to detect how modern the user's browser is. For example Google displays a table based gmail depending on the browser, and a table based layout for Google i开发者_StackOverflow中文版mages also depending on the browser. http://mail.google.com/support/bin/answer.py?hl=en&answer=6557

Google's choice of "modern" browsers is fine with me, but I am unsure how to insure future functionality. When user agent strings change or a new browser is released it seems the list of user agent strings would have to change.

Edit : I ended up using the concept as the mordernizer php server library. I test for functionality and if the default settings aren't correct I set a cookie and refresh the page.


Check out the modernizr-server library, which is a port of Modernizr to php, for detecting what modern features a visitor's browser supports. More information is available in the Modernizr on the server-side blog post.

Browser.php is similar, but detects OS, browser, and version (not whether a particular feature is supported). The Browser Capabilities Project is another possible option.

0

精彩评论

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