Skip to main content
added further details
Source Link
Stephen Lead
  • 21.2k
  • 18
  • 114
  • 241

I've got a Google Map being served inside an iFrame on a page (eg xxx.com/PageWithMap.html)

The code for the Google map sits on another domain (eg yyy.com/MapCode.html)

So it looks like this on xxx.com/PageWithMap.html:

<iframe src="yyy.com/MapCode.html"></iframe>

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

How can I force the hyperlink to change the first page? That is, xxx.com/PageWithMap.html should navigate to xxx.com/photo1.html

I'm finding that xxx.com/photo1.html opens inside the iFrame on xxx.com/PageWithMap.html if I simply click the hyperlink.

Searching on StackOverflow suggests using window.top.location.href 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.

Thanks

I've got a Google Map being served inside an iFrame on a page (eg xxx.com/PageWithMap.html)

The code for the Google map sits on another domain (eg yyy.com/MapCode.html)

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

How can I force the hyperlink to change the first page? That is, xxx.com/PageWithMap.html should navigate to xxx.com/photo1.html

I'm finding that xxx.com/photo1.html opens inside the iFrame on xxx.com/PageWithMap.html if I simply click the hyperlink.

Searching on StackOverflow suggests using window.top.location.href 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.

Thanks

I've got a Google Map being served inside an iFrame on a page (eg xxx.com/PageWithMap.html)

The code for the Google map sits on another domain (eg yyy.com/MapCode.html)

So it looks like this on xxx.com/PageWithMap.html:

<iframe src="yyy.com/MapCode.html"></iframe>

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

How can I force the hyperlink to change the first page? That is, xxx.com/PageWithMap.html should navigate to xxx.com/photo1.html

I'm finding that xxx.com/photo1.html opens inside the iFrame on xxx.com/PageWithMap.html if I simply click the hyperlink.

Searching on StackOverflow suggests using window.top.location.href 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.

Thanks

Source Link
Stephen Lead
  • 21.2k
  • 18
  • 114
  • 241

Map in an iFrame - open hyperlink from infoWindow in the calling page

I've got a Google Map being served inside an iFrame on a page (eg xxx.com/PageWithMap.html)

The code for the Google map sits on another domain (eg yyy.com/MapCode.html)

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

How can I force the hyperlink to change the first page? That is, xxx.com/PageWithMap.html should navigate to xxx.com/photo1.html

I'm finding that xxx.com/photo1.html opens inside the iFrame on xxx.com/PageWithMap.html if I simply click the hyperlink.

Searching on StackOverflow suggests using window.top.location.href 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.

Thanks