Open Google Earth and load specific KML file when user clicks link on web page

泪湿孤枕 提交于 2019-12-02 02:48:00

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!