Can't run Code Playground example from local file

362 Views Asked by At

This is the Map/Earth Integration example at Google's 'Code Playground' site: https://code.google.com/apis/ajax/playground/#maps/earth_integration

I can run that example from the playground just fine. But if I save its html locally and then try to load that file in Chrome, the browser just stalls indefinitely with: Installed Plugin Version: Loading...

An Android app of mine that attempts to load the same example into a WebView does the same thing. That app works fine when running html that employs the API V3 javascript.

The Chrome browser's Developer Tools debugger stops on line 15: "google.load("maps", "2.x");"

saying that "google" is not defined. It also reports that 'GMap2' (line 18) and "GET file://www.google.com/jsapi?key=ABQetc" (line 10) are also not defined.

The Map/Earth Integration example html includes a (long) jsapi key. Do I need to get my own jsapi key maybe? Where do I get one? I have a v2.API_KEY from: "https://console.developers.google.com/project/apps~elite-rider-459/apiui/credential"

but I'm not sure if it will work with Google Earth and Google Earth is not among the available choices at the "APIs % auth" page at that console website:

I remember reading that Google Earth no longer requires such a key. Can anyone tell me what I'm missing? And how to stop Google Earth from embedding itself in my desktop? I tried removing and reinstalling the plug-in, but GE continues to do so.

Thanks, Ted

2

There are 2 best solutions below

0
On

When I ran "Marker V3" code example in Google's Code Playground under "Maps V3" section, on local file, the code didn't execute. I had to add "http:" to script tag that loads Google maps in order to run the code locally.

0
On

When you run this example from local filesystem you must prepend the http: -protocol to the <script/>-src , otherwise the browser will try to load the API from your filesystem(what of course will fail)