7

Possible Duplicate:
best way to detect handheld device in jQuery

I want to make a mobile version of my web app. How I can run a function that will detect if a request is being made from a desktop or mobile browser?

This is so that if the user is requesting from a mobile browser and they click on a link, rather than go to the actual page, it should get hijacked and do some other event..

Thanks in advance..

0

2 Answers 2

8

There are a few scripts on Detect Mobile Browser that redirect mobile visitors on the server side or with JavaScript or jQuery.

Sign up to request clarification or add additional context in comments.

Comments

7

You could use the following to get the platform

navigator.platform 

And this to get the browser app

navigator.appName 

Example:

// Detects if it is an Android device var android = (navigator.platform.indexOf("android")>=0); if (android) { // Do something } 

Also, there is the Advanced Browser Check jQuery Plugin, though it seems like it might be overkill.

2 Comments

exactly what I need. is the transition works well in apple devices?
and is navigator.platform can return the platform version? do you have where jquerymobile crashes in devices?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.