How can I detect if a user is viewing my web site from a mobile web browser so that I can then auto detect and display the appropriate version of my web site?
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
-
Why does the box-shadow property not apply to a
My favorite Mobile Browser Detection mechanism is WURFL. It's updated frequently and it works with every major programming/language platform.
The Mobile Device Browser File is a great way to detect mobile (and other) broswers for ASP.NET projects: http://mdbf.codeplex.com/
There's a brand new solution using Zend Framework. Start from the link to Zend_HTTP_UserAgent:
http://framework.zend.com/manual/en/zend.http.html
Here's how I do it in JavaScript:
See an example at www.tablemaker.net/test/mobile.html where it triples the font size on mobile phones.
This example works in asp.net
You can detect mobile clients simply through
navigator.userAgent
, and load alternate scripts based on the detected client type as: