ios Safari 无法打开页面,因为地址对于 iPad 上的 Google 地图无效

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28441945/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 04:47:24  来源:igfitidea点击:

Safari cannot open the page because the address is invalid for Google Maps on iPad

iosgoogle-mapsipadsafari

提问by Kevin

We have a link that goes to Google Maps for directions using just the normal format for the Google Maps URL: https://www.google.com/maps/dir/Current+Location/38.8992,-77.0482.

我们有一个链接,可以使用 Google 地图 URL 的正常格式访问 Google 地图以获取路线:https: //www.google.com/maps/dir/Current+Location/38.8992,-77.0482

This works fine on google chrome and other browsers don't seem to have this issue either, but somehow on the iPad with OS 8.1.3 using the Safari browser, an alert comes up with the message "Safari cannot open the page because the address is invalid"

这在谷歌浏览器上运行良好,其他浏览器似乎也没有这个问题,但不知何故在使用 Safari 浏览器的操作系统 8.1.3 的 iPad 上,会出现一条警告消息“Safari 无法打开页面,因为地址是无效的”

Is anyone else experiencing this issue?

还有其他人遇到这个问题吗?

The page still does seem to load, but the alert pops up and needs to be dismissed and detracts from the user experience. Since the link follows the Google Maps API standard and seems to work otherwise, what is the reason this is happening and what can be done to stop this from happening?

该页面似乎仍然可以加载,但会弹出警报,需要关闭并降低用户体验。由于该链接遵循 Google Maps API 标准并且似乎可以正常工作,那么发生这种情况的原因是什么以及可以采取哪些措施来阻止这种情况发生?

Also, something strange happened when after the link works a few times, the message no longer comes up when the user is directed to the page. However, after clearing history and data for the Safari browser on iPad, the problem resurfaces again.

此外,当链接工作几次后发生了一些奇怪的事情,当用户被定向到页面时不再出现消息。但是,在清除 iPad 上 Safari 浏览器的历史记录和数据后,问题再次出现。

回答by Adam Grant

In case anyone else arrived here but wasn't getting this error because of a Google Maps link, Look at any JS you have listening to the click event of the link.

如果其他人到达这里但由于 Google 地图链接而没有收到此错误,请查看您正在侦听链接点击事件的任何 JS。

In my case, I had discovered a previous developer added a

就我而言,我发现以前的开发人员添加了一个

e.preventDefault();

to the clickevent.

click活动。

回答by Michael Blankenship

It may be worth noting that--as a PhoneGap developer--I've verified that the iOS's GPS data appears to be higher quality than that, say, on the Android phone or on an HP laptop. The number of digits of precision on the iPad is significantly longer than what's available on other platforms.

值得一提的是——作为 PhoneGap 开发人员——我已经证实 iOS 的 GPS 数据似乎比 Android 手机或惠普笔记本电脑上的 GPS 数据质量更高。iPad 上的精度位数明显长于其他平台上的精度。

It could be that when iOS is pushing so many digits of precision that their server is seeing this as an error. This discussionappears to suggest that Google will throw away unnecessary precision but it's possible that a recent update now at Google Maps is choking on the excess.

可能是当 iOS 推送如此多的精度时,他们的服务器将其视为错误。这个讨论似乎暗示谷歌将放弃不必要的精确度,但谷歌地图最近的更新可能会因过度精确而窒息。

Also note: if your phone is set for a language other than English then the Google API expects the word in that language for "current", for example, "votre+location" in French.

另请注意:如果您的手机设置为英语以外的语言,则 Google API 期望该语言中的单词为“当前”,例如法语中的“votre+location”。