2013-05-03 59 views
0

我在打開日曆應用程序的頁面上有一個iframe,在這個應用程序中,我有一些鏈接是應用程序本身,而其他一些鏈接應該打開在父窗口中。使用如何只打開父窗口上的iframe中的一些鏈接

<base target="_parent" />使所有的鏈接在父窗口打開,但我想只是某種聯繫爲目標的父窗口,並不是所有的...

是有可能有一個跨瀏覽器解?

回答

2

看來你並不真的需要<base>標籤。您可以在這些鏈接上使用target屬性(<a>),以使其行爲不同。

如果您仍然想使用<base>,那麼對於那些沒有target屬性的鏈接,目標將由<base>指定。

例如:

<base target="_self"></base> 
<a href="http://stackoverflow.com" target="_parent">Open SO in parent window/tab</a> 
<br/> 
<a href="http://stackoverflow.com" >Open SO in this window/tab</a> 

jsFiddle

0

隨着該片段打開在

<base target="_parent" /> 
<a target="_parent">your link open in the parent</a> 

的鏈路與該片段打開在IFRAME鏈接本身

<base target="_blank" /> 
<!-- that should even work without the bank --> 
<a target="_blank">your link open in the iframe</a> 

這在所有的瀏覽器

+1

那些將使頁面中的所有鏈接都指向一個指定的位置... – 2013-05-03 11:40:49

+0

你也可以在'a'標籤本身上使用目標 – MatthiasLaug 2013-05-03 11:41:37

+0

爲'a'標籤添加了一個示例 – MatthiasLaug 2013-05-03 11:43:04

2

支持你就不能一個目標參數添加到您想要在父框架中打開鏈接?像<a href="bla.html" target="_parent" />

相關問題