Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a Google Map being served inside an iFrame on a page (eg

The code for the Google map sits on another domain (eg

So it looks like this on

<iframe src=""></iframe>

The markers in the map show an infoWindow which contains a hyperlink to a new page on the first site (eg <a href="">photo link</a>)

How can I force the hyperlink to change the first page? That is, should navigate to

I'm finding that opens inside the iFrame on if I simply click the hyperlink.

Searching on StackOverflow suggests using or target="_parent" or target="_top" but I can't get it to work. Is there an added complication since the hyperlink is within a Google Map infoWindow?

Let me know if the above description isn't clear - unfortunately I can't share the actual site yet but I may be able to make a mockup if necessary.


share|improve this question
I should have added that the parent site is a WordPress page. This may complicate matters as I won't necessarily have full access to run scripts etc on the page. – Stephen Lead Nov 21 '11 at 22:59
up vote 1 down vote accepted

This problem is quite popular and the article referenced below provides a great explanation as to why you can't (and shouldn't) do cross-site scripting ever. It also shows how to circumvent in a legal and safe way the problem:

share|improve this answer

Here is a not tested proposition :

window.opener.parent.location= ""

If it still does not work, could you please provide an online sample.

By the way, this question could also go on SO or ProWebmasters since it's pure javascript.

share|improve this answer

I believe that an iframe can't manipulate its parent document due to security reasons. You will have to use Google Maps API in order to include the map as a part of your site, instead of an iframe.

EDIT: looks like I'm wrong. I did a quick test, a link with target="_parent" inside of an iframe loaded in a parent document.

share|improve this answer

i have the exact same interest! the customized googlemap is located inside an iframe. i would like to click upon the list of infowindows (leftside pane of googlemap) so that I can click through them all using only one NEXT-Button. This button would have to be located in the parent-window of course... any Idea on how to realize this without API? and if that is supposedly not possible, then how would you do it with API?

share|improve this answer
Hi Stefan, I don't have a definitive answer yet but in my case (using a WordPress site) the answer may be to write something in PHP which injects the Google map directly into the page (rather than using an iFrame). I'll let you know how it goes – Stephen Lead Nov 30 '11 at 20:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.