Open Google Earth and load specific KML file when user clicks link on web page
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.
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
精彩评论