问题描述
我正在尝试创建一个具有自己的后退和前进按钮的小部件(基本上是一个iframe)。
也就是说,当我点击小部件后退按钮时,只有iframe返回,而不是整个小部件容器(类似iGoogle的门户)
I'm trying to create a widget (which is basically an iframe) that would have its own back and forward buttons.That is, when I hit the widget back-button, only the iframe goes back, not the entire widget container (the iGoogle-like portal)
I添加了以下链接:
<a class="button" href="#" onclick="history.back();return false;">
当我将小部件作为常规网页加载时,它可以正常工作,但是当它从iframe中。
It works when I load my widget as a regular webpage, but not when it is used from within the iframe.
我用谷歌搜索了一下这篇文章:
I googled a little bit to find this post:
可能与该contentWindow属性有关,但是到目前为止没有。问题是我无法获得门户使用的框架的名称(无论如何都是随机的)
Maybe there is something to do with that contentWindow attribute, but so far nothing. The issue is that I can't get the name of the frame that is used by the portal (which is random anyway)
我觉得我错过了什么。 ..任何提示?
I feel like I'm missing something... any hints?
谢谢!
推荐答案
因为你的小部件并且页面托管在不同的域下,原因是您无法通过脚本从iframe访问父页面。
Since your widget and the page are hosted under different domains for sequre reasons you won't get access from iframe to the parent page by scripts.
这篇关于iframe中的后退按钮(类似iGoogle的门户网站的小部件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!