当用户单击网页上的链接时,打开 Google 地球并加载特定的 KML 文件
我目前正在开发一个网站,该网站在 Google 地图中显示地图数据,但也有一个在 Google 地球中显示地图数据的链接。
要在 Google 地球中查看此数据,用户单击链接,下载文件,然后使用 Google 地球打开该文件。有没有一种方法可以自动执行此操作,以便用户可以单击链接并在 Google Earth 中自动打开文件,类似于 iTunes 网上商店?
我搜索了文档但收效甚微。
I'm currently working on a site which displays map data in Google Maps, but also has a link to display it in Google Earth.
To get view this data in Google Earth, a user clicks the link, downloads the file, then opens the file with Google Earth. Is there a method to automate this, so that a user can click the link and the file is automatically opened in Google Earth, similar to the iTunes web store?
I've searched through the documentation to little avail.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,您不能强迫用户计算机启动这样的应用程序。但是,如果用户愿意,可以在某些操作系统和某些浏览器中自行设置。
例如,在 Windows 中,我有与 kml 和 kmz 文件扩展名关联的 Google Earth。我使用 Google Chrome 浏览。当我单击 kml/kmz 文件的链接时,它会正常下载。然后,我可以在下载栏中选择“始终打开这种类型的文件”。因此,当我单击 kml/kmz 文件的链接时,它会在 Google 地球中自动打开。
如果一个网站可以“强制”这种行为,那么它不仅会非常烦人,而且还会带来巨大的安全风险。
另外,为什么不直接使用基于网络的 Google 地球版本呢?使用 Google Maps Api 直接集成它非常简单。
即:
http://earth-api-samples.googlecode .com/svn/trunk/demos/mapsapi/index.html
http://earth-api-samples.googlecode.com/svn /trunk/demos/mapsapi/beefy.html
No, you can't force the users machine to launch an application like that. However, a user can set this up themselves if they wish in certain operating systems with certain browsers.
For example, in Windows I have Google Earth associated with the kml and kmz file extensions. I browse using Google Chrome. When I click a link to a kml/kmz file it is downloaded as per normal. In the download bar I can then choose to "Always open files of this type". Thus, when ever I click a link to a kml/kmz file it is automatically opened in Google Earth.
If a site could 'force' this behaviour not only would it be immensely annoying it would also be a massive security risk.
Also, why not just use the web based version of Google Earth? It is pretty simple to intergate it directly using the Google Maps Api.
i.e:
http://earth-api-samples.googlecode.com/svn/trunk/demos/mapsapi/index.html
http://earth-api-samples.googlecode.com/svn/trunk/demos/mapsapi/beefy.html