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.

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 (http://www NULL.zytrax NULL.com/tech/web/mobile_ids NULL.html)

JavaScript code use navigator.userAgent

<button onclick="alert(navigator.userAgent);">User Agent</button>
 

Comments are closed.



Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...