Back button in an iframe (widget for an iGoogle-like portal)(iframe 中的后退按钮(类似 iGoogle 的门户的小部件))
问题描述
我正在尝试创建一个具有自己的后退和前进按钮的小部件(基本上是 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 的门户的小部件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:iframe 中的后退按钮(类似 iGoogle 的门户的小部件)
基础教程推荐
- fetch 是否支持原生多文件上传? 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- 在 contenteditable 中精确拖放 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- Bokeh Div文本对齐 2022-01-01
