Skip to content

Instantly share code, notes, and snippets.

@quadrochave
Created February 14, 2018 12:20
Show Gist options
  • Save quadrochave/7960b3d83055110c6d7bae523bc387f8 to your computer and use it in GitHub Desktop.
Save quadrochave/7960b3d83055110c6d7bae523bc387f8 to your computer and use it in GitHub Desktop.
Verifica Dispositivo Verifica dispositivo // source https://jsbin.com/nutami
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Verifica dispositivo">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<title>Verifica Dispositivo</title>
<p id="mobile-msg"></p>
</head>
<body>
<script id="jsbin-javascript">
// Código original: https://www.opentechguides.com/how-to/article/javascript/98/detect-mobile-device.html
device = new RegExp ('Android|webOS|iPhone|iPad|' +
'BlackBerry|Windows Phone|' +
'Opera Mini|IEMobile|Mobile' ,
'i');
if (device.test(navigator.userAgent)) {
if (screen.orientation.angle === 0 )
document.getElementById("mobile-msg").innerHTML = "Gira o bagulho !";
window.addEventListener("orientationchange", function() {
document.getElementById("mobile-msg").innerHTML ="É nós ! landascpe ângulo= " + screen.orientation.angle
});
} else {
document.getElementById("mobile-msg").innerHTML = "Coé, tu tá no desktop ! Testa no celular";
}
</script>
<script id="jsbin-source-javascript" type="text/javascript">// Código original: https://www.opentechguides.com/how-to/article/javascript/98/detect-mobile-device.html
device = new RegExp ('Android|webOS|iPhone|iPad|' +
'BlackBerry|Windows Phone|' +
'Opera Mini|IEMobile|Mobile' ,
'i');
if (device.test(navigator.userAgent)) {
if (screen.orientation.angle === 0 )
document.getElementById("mobile-msg").innerHTML = "Gira o bagulho !";
window.addEventListener("orientationchange", function() {
document.getElementById("mobile-msg").innerHTML ="É nós ! landascpe ângulo= " + screen.orientation.angle
});
} else {
document.getElementById("mobile-msg").innerHTML = "Coé, tu tá no desktop ! Testa no celular";
}</script></body>
</html>
// Código original: https://www.opentechguides.com/how-to/article/javascript/98/detect-mobile-device.html
device = new RegExp ('Android|webOS|iPhone|iPad|' +
'BlackBerry|Windows Phone|' +
'Opera Mini|IEMobile|Mobile' ,
'i');
if (device.test(navigator.userAgent)) {
if (screen.orientation.angle === 0 )
document.getElementById("mobile-msg").innerHTML = "Gira o bagulho !";
window.addEventListener("orientationchange", function() {
document.getElementById("mobile-msg").innerHTML ="É nós ! landascpe ângulo= " + screen.orientation.angle
});
} else {
document.getElementById("mobile-msg").innerHTML = "Coé, tu tá no desktop ! Testa no celular";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment