开发者

Php user-agent Graceful Degradation

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜