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 ); }); }
<a class="map-link" href="">link to map</a>

Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributing developer to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.

Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk