带 IFRAMES 的后退按钮循环
在我的(学校)网站中,我们使用 Iframe 来显示班级博客(在博客上)。这很有效,除非用户随后单击(例如)iframe 内的照片。 Blogger(在本例中)然后在整个浏览器窗口中显示照片,并且后退按钮循环;也就是说,如果按下后退按钮,浏览器(IE、FF、Chrome)将停留在同一页面上。唯一的出路是用户跳回两页(我们的许多用户不知道该怎么做)。 我读过很多关于后退按钮和 iframe 的帖子,但似乎没有一个简单的解决方案。请记住,我无法控制 iframe 内容(因此框架中不可能嵌入后退按钮)。有人有想法吗?
In my (school) website we use Iframes to display class blogs (on blogger). This works well EXCEPT if the user then clicks on (say) a photo inside the iframe. Blogger (in this case) then displays the photo in the whole browser window and the back button loops; that is if the back button is hit, the browser (IE, FF, Chrome) stays on the same page. The only way out is for the user to jump back two pages (which many of our users don't know how to do).
I've read a lot of posts on back buttons and iframes and there doesn't appear to be a simple solution. Bear in mind that I don't have control over the iframe content (so no embedded back buttons in the frame are possible). Ideas anyone?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用的解决方案是在加载 iframe 内容后对其进行循环,并在 iframe 中的链接上设置目标属性,以便它们在 iframe 或新窗口中打开。这是一个使用 jQuery 的示例:
您可以使用循环和 DOM 方法执行类似的操作,如果您不确定如何执行此操作,我将发布一些代码来执行此操作。
编辑:如果跨域,则无法访问内容,因此在这种情况下这不起作用
The solution I would use would be to loop through the iframe content after it has been loaded and set target attributes on links in the iframe so that they open in either the iframe, or in a new window. Here's an example using jQuery:
You could do something similar using a loop and DOM methods, I'll post some code to do that if your not sure how to go about it.
EDIT: can't access the content if its cross domain, so this wouldn't work in this case