如何强制在父窗口中打开iframe的链接 [英] How to force link from iframe to be opened in the parent window

查看:112
本文介绍了如何强制在父窗口中打开iframe的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



注意: iframe 和父页面是同一个域 我找到了最好的解决方案是使用基本标记。将以下内容添加到iframe中页面的头部:

 < base target =_ parent> 

这会加载父窗口中页面上的所有链接。如果您希望将链接加载到新窗口中,请使用:

 < base target =_ blank> 

这个标签是完全支持所有浏览器中的内容。


I need to open the link in the same parent page, instead of open it in a new page.

note : The iframe and parent page are the same domain.

解决方案

I found the best solution was to use the base tag. Add the following to the head of the page in the iframe:

<base target="_parent">

This will load all links on the page in the parent window. If you want your links to load in a new window, use:

<base target="_blank">

This tag is fully supported in all browsers.

这篇关于如何强制在父窗口中打开iframe的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆