问题描述
我要建一个移动版的网站,试图有一个点击链接可启动谷歌地图与行车方向的业务,从用户的当前位置。我有它工作正常的iPhone,但在Android上进行测试时,它认为当前%20Location,并试图找到一个业务叫做当前位置。这是我目前的code:
I'm building a mobile-version of a website, trying to have one-click link to launch Google Maps with driving directions to the business, from the user's current location. I have it working fine for the iPhone, but when testing on Android, it views 'Current%20Location' and tries to find a business called 'Current Location'. Here is my current code:
<a href="http://maps.google.com/maps?saddr=Current%20Location&daddr=123 Street Rd,Cityville,MD,21098">Get Directions</a>
我需要一个通用的字符串从当前位置进行搜索,并不能找到一个明确的答案在网上的任何地方。
I need a universal string to search from the current location, and can't find a definitive answer anywhere online.
在此先感谢您的帮助!
推荐答案
我在做同样的事情,现在有工作在Android上。我没有一个iPhone,所以我没有办法在该测试。你应该离开SADDR参数空白的URL,然后谷歌地图将与用户的当前位置pre灌注了。此外,使用+符号,而不是空间中的目的地址。这里的更正网址:
I am doing the same thing and now have it working on Android. I don't have an iPhone so I have no way of testing on that. You should leave the saddr parameter blank in the URL, and Google Maps will then prefill it with the user's current location. Also, use + signs instead of spaces in the destination address. Here's the corrected URL:
<一个href="http://maps.google.com/maps?saddr=&daddr=123+Street+Rd,Cityville,MD,21098">http://maps.google.com/maps?saddr=&daddr=123+Street+Rd,Cityville,MD,21098
这篇关于从当前位置移动网络的行车路线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!