How to open links from inframe outside of it?

耗尽温柔 提交于 2019-12-11 23:20:12

问题


well I have that problem, im using a lightbox srcipt and im opening an iframe in it so it's simply iframe. Is there a way to put a link inside of this iframe and open this link in normal window (outside of iframe) ?


回答1:


Use <a href="..." target="_top">My Link</a>to put it on top of all other frames (break out).

_blank will put in a new window or tab

_parent will put the link in the frame above the current (same as _top if only one level of frame)

Using the name (not id) of a frame will open the link in that frame.

http://www.w3schools.com/tags/att_a_target.asp




回答2:


If you want to open the link in a new window/tab, use the _blank target:

<a href="someurl..." target="_blank">

If you want to open the link so that it replaces the page where the iframe is, use the _top target:

<a href="someurl..." target="_top">



回答3:


Try adding target="_parent" to the link tag, to open the link in the parent page that contains the IFrame, or target="_blank, to open the link in a new browser window.

target="_blank"       New window
target="_self"        Current window
target="_parent"      Parent frame
target="_top"         Full browser window


来源:https://stackoverflow.com/questions/11193839/how-to-open-links-from-inframe-outside-of-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!