Link to iPhone map App from HTML page

后端 未结 4 768
醉话见心
醉话见心 2020-12-30 09:46

Is there a way to link to directions in the iPhone map app from a html page?

We\'re placing an add in an iPhone app which will link to a mobile page on our website -

相关标签:
4条回答
  • 2020-12-30 10:22

    Here is a javascript function that creates the link:

    function mapLink(myAddress) {
        return 'http://maps.google.com/maps?q='+escape(myAddress);
    }
    

    This works great on the iPhone.

    0 讨论(0)
  • 2020-12-30 10:22

    Use something like:

    <a href='maps:daddr=<destination>&saddr=Current%20Location'>Directions</a>
    

    where may be a lat/lon pair (separated by a comma) or a place. Ensure you URI encode the destination to ensure it works.

    0 讨论(0)
  • 2020-12-30 10:28

    A link to http://maps.google.com/maps will automatically open in the map application

    You can set a destination address (daddr) and start address (saddr) in the link:

    http://maps.google.com/maps?daddr=San+Francisco,+CA&saddr=cupertino

    You can see some more options at:

    https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html

    0 讨论(0)
  • 2020-12-30 10:28

    If you use the standard link that would display a map in the browser, it will automatically open in Google Maps on the device. That includes links that show directions.

    0 讨论(0)
提交回复
热议问题