Reputation: 214
I'm creating a map in Google Earth using geocoding location search and KMZ overlays. As it turns out, Google Earth probably wasn't the best way to build this due to having to download the plugin. Instead of scrapping all the work with Google Earth entirely I was hoping I could find a way to figure out if a clients PC had the Google Earth plugin and if so, load option one, if no, load option 2.
Does anyone know what the best way to approach this would be?
Here is the current implementation: http://www.plexicomm.net/coverage/
While my skills with PHP are subpar and with JS even less so, I'm sure with a few pointers I could cobble something together that makes the 'choice' part either in-page (using some modification of the Java-script, or even a simple redirect on the fail) or with some PHP<->JS code that simply sends someone without the plug-in to a different page entirely.
Thanks in advance!
Upvotes: 1
Views: 635
Reputation: 117334
Load the earth-API and when it's loaded use the method isInstalled()
to check if the plugin is available.
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("earth", "1");
google.setOnLoadCallback(function(){
if(google.earth.isInstalled()){
//do something with google earth
}else{
//do something with google maps
}
});
</script>
Upvotes: 3