Skip to content

Instantly share code, notes, and snippets.

@Pushplaybang
Created September 16, 2012 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Pushplaybang/3732015 to your computer and use it in GitHub Desktop.
Save Pushplaybang/3732015 to your computer and use it in GitHub Desktop.
basic mobile phone detection - still to test
<script type="text/javascript">
$(document).ready(function () {
var deviceAndroid = "android";
var deviceIphone = "iphone";
var deviceBlackberry = "blackberry";
var uagent = navigator.userAgent.toLowerCase();
DetectDevice();
function DetectDevice() {
if (uagent.search(deviceAndroid) > -1) {}
else if (uagent.search(deviceIphone) > -1) {}
else if (uagent.search(deviceBlackberry) > -1) {}
else { }
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment