简体   繁体   English

iframe点击链接它会在父页面而不是在iframe页面中打开

[英]iframe click link it opens in parent page rather than in iframe page

User clicks on URL hyperlink ( http://example.com ) within a iframe dialog window, dialog window closes and link is open in parent page. 用户在iframe对话框窗口中单击URL超链接( http://example.com ),关闭对话框窗口并在父页面中打开链接。

how do you open the clicked link in the parent page instead of inside the iframe page? 如何在父页面中而不是在iframe页面中打开单击的链接?

iFrame页面上:

<a href="javascript:parent.window.location.href='http://cnn.com/';">Go to CNN</a>

If its an <a /> tag then set the target attribute to _parent 如果是<a />标记,则将target属性设置为_parent

This will open the linked document in the parent frameset 这将打开父框架集中的链接文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM