Skip to content

Instantly share code, notes, and snippets.

@afiqiqmal
Created April 2, 2021 02:25
Show Gist options
  • Save afiqiqmal/888f2fc9145a3acf86f3c285892b0859 to your computer and use it in GitHub Desktop.
Save afiqiqmal/888f2fc9145a3acf86f3c285892b0859 to your computer and use it in GitHub Desktop.
Google Map URL Testing for iOS user
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
</head>
<body>
<div class="p-5">
<a class="btn btn-dark mt-3" href="https://www.google.com/maps/search/?api=1&query=47.5951518,-122.3316393" target="_blank">Google Map Link</a>
<a class="btn btn-dark mt-3" href="comgooglemaps://?center=40.765819,-73.975866&zoom=14&views=traffic" target="_blank">Google Map (comgooglemaps)</a>
<a class="btn btn-dark mt-3" href="geo:37.786971,-122.399677" target="_blank">Google Map (geo:)</a>
<a class="btn btn-dark mt-3" href="google.navigation:q=23.3728831,85.3372199" target="_blank">Google Map (google.navigation:)</a>
<a class="btn btn-dark mt-3" href="maps://www.google.com/maps/dir/?api=1&destination=47.5951518,-122.3316393" target="_blank">Google Map (maps:)</a>
<div class="m-4">
<span id="user"></span>
</div>
</div>
<script
src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.bundle.min.js" integrity="sha384-LtrjvnR4Twt/qOuYxE721u19sVFLVSA4hf/rRt6PrZTmiPltdZcI7q7PXQBYTKyf" crossorigin="anonymous"></script>
<script>
function iOS() {
return [
'iPad Simulator',
'iPhone Simulator',
'iPod Simulator',
'iPad',
'iPhone',
'iPod'
].includes(navigator.platform)
|| (navigator.userAgent.includes("Mac") && "ontouchend" in document)
}
$('#user').text(iOS() ? 'You are ios user' : '');
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment