直接链接到 Google 地图交通路线移动网站

发布于 2024-10-09 08:07:07 字数 214 浏览 0 评论 0原文

如果您在移动设备上访问maps.google.com,然后按“菜单”、“获取路线”并选择“公交”选项,您将进入一个页面,您可以在其中输入两个位置和日期/时间,并获取公共交通路线。但是,URL 仍然是maps.google.com。

有没有办法直接链接到此页面,以便我可以将其加载到我的 iOS 应用程序的 UIWebView 中? “点击”Javascript 中的按钮是(唯一/好的)解决方案吗?

If you visit maps.google.com on a mobile device, then press 'Menu', 'Get Directions', and select the 'transit' option, you are taken to a page where you can enter two locations and a date/time, and get directions on public transit. However, the URL is still maps.google.com.

Is there any way to link directly to this page so that I can load it in a UIWebView in my iOS app? Would 'clicking' the buttons in Javascript be (the only/a good) solution?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

等待我真够勒 2024-10-16 08:07:07

即使单击 javascript 中的按钮似乎也不起作用。谷歌地图代码有点奇怪 - 事件监听器不是直接分配的,我无法让 .click() 工作。所以我要做的就是让用户在应用程序的框中输入两个位置,然后加载类似 http://maps.google.com/maps?f=d&source=s_d&saddr=Coover+Hall&daddr=lied+rec +center 在 UIWebView 中,但我将在构建 URL 之前添加一些更具体的位置信息,因为这是一个特定于城市的应用程序。这不是一个完美的解决方案,但它可以完成工作。

Even clicking the buttons in javascript doesn't seem to be working. The Google Maps code is a little strange- the event listeners aren't assigned directly and I can't get a .click() to work. So what I'll do is have the user enter the two locations in boxes in the app, then load something like http://maps.google.com/maps?f=d&source=s_d&saddr=Coover+Hall&daddr=lied+rec+center in the UIWebView, except I'll add some more specific location information before building the URL, since this is a city-specific app. Not a perfect solution but it gets the job done.

扮仙女 2024-10-16 08:07:07

您可以创建一个链接到带有“dirflg=r”参数的公交路线的 URL。

在此处查找其他网址参数:http://web. archive.org/web/20110714031648/http://mapki.com/wiki/Google_Map_Parameters

You could create a URL that links to the transit directions with the "dirflg=r" paramater.

Find the other URL parameters here: http://web.archive.org/web/20110714031648/http://mapki.com/wiki/Google_Map_Parameters

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文