简体   繁体   English

如何从iOS6中的完整模式网站打开本地地图,具有向后兼容性

[英]How to open native maps from full mode website in iOS6 with backward compatibility

Need to open native maps app on iPhone and/or android phones out of a mobile website. 需要在移动网站上的iPhone和/或Android手机上打开原生地图应用程序。 Currently I did this by simply open a maps.google.com link. 目前,我只需打开maps.google.com链接即可。

Since iOS6 is released this seems not working any more. 自从iOS6发布以来,这似乎不再适用了。 Are there any standardized or at least well known methods to accomplish opening native maps on most platforms? 是否有任何标准化或至少众所周知的方法可以在大多数平台上完成打开本机地图?

If not, can I check the mobile OS to do some special things on every mobile phone? 如果没有,我可以检查移动操作系统在每部手机上做一些特殊的事情吗?

In order to support opening the native maps app across the most recent iOS versions you're going to have to check the type of device, as iOS 6 devices will direct users to the google maps website, rather than their native app. 为了支持在最新的iOS版本中打开原生地图应用程序,您将不得不检查设备的类型,因为iOS 6设备会将用户引导到谷歌地图网站,而不是他们的原生应用程序。

The best way to detect devices is via the User-Agent HTTP header. 检测设备的最佳方法是通过User-Agent HTTP标头。 This is documented all over the net with front end javascript device detection, or back end device detection. 这是通过前端javascript设备检测或后端设备检测在整个网络中记录的。 How you approach the detection is up to your own implementation. 您如何进行检测取决于您自己的实施。

You can continue to use maps.google.com for everything other than iOS 6 I believe and Apple have documented their iOS6 Maps URL scheme in their Map Links documentation. 您可以继续将maps.google.com用于iOS 6以外的所有内容,我相信Apple已在其Map Links文档中记录了他们的iOS6 Maps URL方案。

An example of an Apple Maps link would be Apple Maps链接的一个例子是

<a href="http://maps.apple.com/maps?daddr=San+Francisco,+CA&saddr=cupertino">Directions</a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM