Convert Google Maps links to Apple Maps on iOS

// Change Google Maps links to Apple Maps on iOS
var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
if( !! iOS ) {
var links = document.body.querySelectorAll('.map-link');
links.forEach( function(e) {
var url = e.getAttribute('href').replace('google', 'apple');
e.setAttribute('href', url );
});
}
view raw global.js hosted with ❤ by GitHub
<a class="map-link" href="https://maps.google.com/?q=6750+West+Loop+South%2C+Suite+920+Bellaire+TX+77401">link to map</a>
view raw page.html hosted with ❤ by GitHub

javascript