【发布时间】:2020-02-15 02:59:10
【问题描述】:
当我第一次使用谷歌地图 URL 打开谷歌地图时(如果谷歌地图没有在后台运行)方向将不会显示。如果谷歌地图在后台运行,则方向将正确显示。我正在研究 Cordova,在 android 中,这个问题不存在,但在 iOS 中,我遇到了这个问题。 我的代码是: 我使用了所有这些 URL,但如果 Google 地图没有在后台运行,它就无法在 iOS 中运行。
var mapLocationUrl = "https://maps.google.com/maps?saddr=current location&daddr=" + lat + "," long;
var mapLocationUrl = "https://www.google.com/maps/dir/?api=1&destination=" + lat + "," + long + "&travelmode=driving";
var mapLocationUrl = "maps://maps.google.com/maps?daddr=" + lat + "," + long + "&ll=";
var mapLocationUrl = "comgooglemaps://?saddr=&daddr=" + lat + "," + long;
var mapLocationUrl = "https://maps.google.com/maps?origin=My Location" + "&daddr=" + lat + "," + long;
var mapLocationUrl = "https://maps.google.com/maps?daddr=" + lat + "," + lng;
window.open(encodeURI(mapLocationUrl), '_self', 'location=yes');
window`.open(encodeURI(mapLocationUrl), '_system', 'location=yes');
【问题讨论】:
标签: javascript jquery ios google-maps cordova