This is the situation: I need to make JQuery responsive for my app, for example to make the Google Map draggable:true on the pc and false on tablet and phone, and i am facing this argument for the first time. I am making some tests.
This is what have done: I try to study the best way to approach it, and the best way (that is working properly) it seems to be found in this SO answer:
What is the best way to detect a mobile device in jQuery?
In the specific, This is the code:
var isMobile = navigator.userAgent.match(/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/);
if (isMobile) {
alert('is not pc');
}
else {
alert('is a pc');
}
This is a simple test:
http://jsbin.com/IroMAQi/1/edit
Other solutions founded: Have found interesting also this approach:
Do something if screen width is less than 960 px
But strange enough, with my tablet Samsung Galaxy Tab 3 the first solution is not working.
This is the question:
The best way to make JQuery responsive is to detect the navigator.userAgent.match?
If yes, how can i be sure to include in the list all the possible devices? For example i know that just recently has been published the new Firefox phone, how can i include also that device? There is perhaps a kind of list with all different possibilities?
Thank you very much!! Sorry if it is a stupid question, is that i am knew in this, and at this point only Stack Overflow can clarify this for me!