簡體   English   中英

如何打開iframe外部的鏈接,從而將iframe源代碼打開到新窗口?

[英]How to open link outside of iframe that opens iframe source into new window?

<a href="//source of iframe name blah//" target="about:blank">open in new window</a>

<a href="1.html" target="blah">link 1</a>
<a href="2.html" target="blah">link 2</a>
<a href="3.html" target="blah">link 3</a>

<iframe name="blah" src="blah.html" ></iframe>

我有一個包含iframe的頁面。 我有打開iframe內頁面的鏈接,因此iframe不僅有一個不變的來源。 我希望有一個鏈接可以將iframe中當前存在的任何源打開到新窗口中,無論它是1.html,2.html還是3.html等(將不斷添加更多頁面,因此不會)將來只有三歲)。

我將如何實現此鏈接? 提前非常感謝您! :〜)

嘗試這個,

$(function(){
    $('a[target="blah"]').on('click',function(e){
       e.preventDefault();
       window.open(this.href,'blah');
    });
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM