Created
September 14, 2015 18:08
-
-
Save celsofabri/0e9a91d119347f0a0943 to your computer and use it in GitHub Desktop.
Identifica dispositivo mobile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
function device_detect() { | |
if( navigator.userAgent.match(/Android/i) | |
|| navigator.userAgent.match(/webOS/i) | |
|| navigator.userAgent.match(/iPhone/i) | |
|| navigator.userAgent.match(/iPad/i) | |
|| navigator.userAgent.match(/iPod/i) | |
|| navigator.userAgent.match(/BlackBerry/i) | |
|| navigator.userAgent.match(/Windows Phone/i)){ | |
alert('Seu dispositivo mobile foi detectado'); | |
// Insira o seu código aqui. | |
} | |
else { | |
alert('Se não for detectado o dispositivo'); | |
} | |
} | |
device_detect(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment