Detect Mobile Devices

1
2
var isMobile = {
Android: function () {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Contains logic which determines the type of mobile device. for eg. android,ios,windows etc

How to Use :

if (isMobile.Android()) {
// Do Some Stuff Specially For Android Devices.
e,g : Android.write_data(data);
}

1 Response

isn't better this way?

if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
// some code..
}

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.