2010-08-20 33 views
2

我在NOKIA 6800浏览器上使用“google本地” 搜索结果页面有链接“在地图上查看?” 点击它启动Google地图应用程序,并以搜索结果的位置 为中心的地图。从移动浏览器启动谷歌地图

怎么做? Javascript?我见过类似的行为在iPhone

回答

3

对于静态地图,你可以使用:

http://maps.google.com/maps/api/staticmap?center=kerstendalseweg%2017,berg%20en%20dal,%20nederland&zoom=14&size=400x400&sensor=false 

裹在一个HTML页面中使用的锚:

<a href="http://maps.google.com/maps/api/staticmap?center=kerstendalseweg%2017,berg%20en%20dal,%20nederland&zoom=14&size=400x400&sensor=false">Go to Vette BSO</a> 

对于开始导航我用这个(带启动EN目的地址)

<a href="http://maps.google.com/maps?saddr=kerstendalseweg 17, berg en dal, nederland&daddr=51.8285781,5.9287059">Go to Vette BSO</a> 

google maps API docs: 您还可以轻松链接到Google地图以获取行车路线。我们建议您在Google地图上使用以下格式的行车路线:

http://maps.google.com/maps?saddr={start_address}&daddr={destination_address} 
1

这取决于您使用的手机。

在Android上,您可以在网址中使用http://maps.google.com/maps?前缀或geo:lat,long?前缀。 Invoking Google Applications on Android Devices

在iPhone上,你可以使用comgooglemaps://?前缀: Google Maps iOS URL Scheme

为了检测移动设备类型使用下面的Java脚本(这一个检测iPhone或iPad):

if ((userAgent.indexOf('iPhone') != -1) || (userAgent.indexOf('iPad') != -1)) 
    window.location = "comgooglemaps://?saddr=london&daddr=manchester" 
+0

这是我寻找。谢谢! – rpax 2014-08-25 17:20:30