linkSchemaData jQuery Plugin
The purpose of this plugin is to parse schema.org/postalAddress formatted data and wrap it in a link which will open a native mapping app for mobile devices. It also has a default behaviour which will open a mapping site (google maps) for all other devices.The reason this requires a plugin is because there is no standard way to open a map app on a mobile device.
HTML
<a style="cursor: pointer;" class="myNavFunc">Take me there!</a>
CSS
p{
margin:0 0 0.5em 0;
}
.mapLink{
color: green;
text-decoration: none;
}
.mapLink:hover{
color: red;
text-decoration: underline;
}
JavaScript
$('.myNavFunc').on('click',function(){
myNavFunc();
});
function myNavFunc(){
// If it's an iPhone..
if( (navigator.platform.indexOf("iPhone") != -1)
|| (navigator.platform.indexOf("iPod") != -1)
|| (navigator.platform.indexOf("iPad") != -1))
window.open("maps://maps.google.com/maps?daddr=10.85311,77.42443&ll=");
else
window.open("http://maps.google.com/?q=Banasura Hill Resort, Wayanad, Kerala");
}