-2

I am just starting out with the google maps API and following the tutorials. This first one works fine

https://developers.google.com/maps/documentation/javascript/adding-a-google-map

But it seems that none of the others are working and I'm not sure why. Let's keep it simple with two examples. The first one linked above works and loads the map as expected.

Then I try this one (or pretty much any other one) and nothing loads

https://developers.google.com/maps/documentation/javascript/examples/icon-simple

I am putting my API key in properly, and I have gone into my API console and enabled my blog to use the API.

I turn no the javascript console and get :

"the target origin provided" "does not match the recipient window's origin"

But I think it is a red herring because I get that as well for the one that works. Same messages.

Any idea what I am doing wrong?

I googled those errors and got a whole bunch of stuff that does not seem to apply to maps APIs.

Thanks.

1 Answers1

0

That error isn't specific to the Google Maps API; rather it suggests you're mixing protocols (http and https). See answers to this question if you want more details.

In short, try changing API calls from http to https, or vice-versa. If you have references like: //maps.googleapis.com/maps/api/js..., try explicitly putting "https" or "http" at the start.

I'll edit my answer with more information if you provide more details (code, complete error message).

rotarydial
  • 2,181
  • 2
  • 23
  • 27
  • As for the exact code I am using I just copy and paste the examples from the two pages noted and the only change I make is my API Key. But like I said I think it is a red herring because the first one works even though I get this message: cb=gapi.loaded_0:333 Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://accounts.google.com') does not match the recipient window's origin ('https://www.blogger.com'). – Prospector Sixteen Feb 25 '18 at 12:43
  • That was for the one that works. The one that does not work says basically the same thing Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://accounts.google.com') does not match the recipient window's origin ('https://www.blogger.com'). – Prospector Sixteen Feb 25 '18 at 12:46
  • So there must be some other reason that the code examples are not working. – Prospector Sixteen Feb 25 '18 at 12:46