| Detect user's device and redirect to a mobile web |
|
While working on mobile web, first is think about how to detect the user's device. If the user is using a mobile device, then you have to redirect to a mobile web, not a general long and 3 or 4 columns website. In Apache web server, Browser ID, more correctly called User Agent IDs, is the environmental variable HTTP_USER_AGENT. In dot net server (ASPX), you can use a string variable Request.UserAgent. Here is a great place you can find a whole list of the Mobile Browser ID strings, a.k.a. User Agent ID: http://www.zytrax.com/tech/web/mobile_ids.html JavaScript code use navigator.userAgent
<button onclick="alert(navigator.userAgent);">User Agent</button>
|