Skip to content

Changes Google Maps links to the "maps:" format on iOS devices

Notifications You must be signed in to change notification settings

rtvenge/iOSifyMaps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iOSifyMaps.js

JavaScript script that changes Google Maps formatted links to iOS formatted links only on iOS devices.

What it does

  • Checks for an iOS Device via User Agent String (checks for iPhone, iPod and iPad)
  • Get's all anchor tags
  • Get's href of each anchor
  • Changes url from "maps.google.com" to "maps.apple.com"

How to Implements

  1. Place <script type="text/javascript" src="iOSifyMaps.js"></script> tag referring to js file right BEFORE </body> tag
  2. Use the following JavaScript after including this JS file: <script>document.getElementsByTagName('a').iOSifyMaps();</script>
  3. For more efficient JS, add an id to the targeted element and use getElementByID: <script>document.getElementByID('mapsLink').iOSifyMaps();</script>
  4. This can also be used with jQuery: <script>$('a[href*="maps.google.com"]').iOSifyMaps();</script>

About

Changes Google Maps links to the "maps:" format on iOS devices

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published