我正在尝试创建一个具有自己的后退和前进按钮的小部件(基本上是 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)
我添加了以下链接:
<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:
http://www.bennadel.com/blog/1592-Getting-IFRAME-Window-And-Then-Document-References-With-contentWindow.htm
也许与该 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 的门户的小部件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!