Back button in iframe (widget for iGoogle oriented portal)

I am trying to create a widget (which is basically an iframe) that will have its own back and forward buttons. That is, when I click on the widget button, only the iframe is returned, not the whole widget container (portal like iGoogle).

I have added the following links:

<a class="button" href="#" onclick="history.back();return false;">

      

It works when I load my widget like a normal webpage, but not when used from an iframe.

I searched a bit to find this post:

http://www.bennadel.com/blog/1592-Getting-IFRAME-Window-And-Then-Document-References-With-contentWindow.htm

It might have something to do with this contentWindow attribute, but nothing so far. The problem is that I cannot get the name of the frame that the portal is using (which is random anyway)

I feel like I'm missing something ... any hints?

Thanks!

+2


a source to share


2 answers


Since your widget and page are hosted on different domains for consistency reasons, you won't get scripted access from the iframe to the parent page.



+2


a source


Try the following:



<a class="button" href="#" onclick="parent.history.back();return false;">

      

0


a source







All Articles