2011-06-14 97 views
0

我有一個頁面顯示在框架中作爲另一個站點的一部分。我想添加一個鏈接到這個頁面,這將允許用戶在新窗口中打開頁面,即在框架外。我該怎麼做呢?javascript - 在新窗口中打開框架

我一直在使用

<a href="javascript:window.location.href" target="_blank">Remove frame</a> 

嘗試,但並沒有工作,只打開一個新窗口javascript:window.location.href

+0

實際上將當前頁面的真實URL放入鏈接的最佳解決方案。 – RoToRa 2011-06-14 10:32:27

+0

@RoToRa他們是動態網頁,所以不知道實際的網址 – John 2011-06-14 10:45:28

+0

你是什麼意思與「動態」?任何動態創建HTML文檔(特別是服務器端腳本)通常都會提供一種獲取它自己的URL的方法。 – RoToRa 2011-06-14 11:05:33

回答

0

嘗試地址:

<a href="javascript:window.location='whereiwanttogo.html';" target="_blank"> 
0

你可以利用這一點,它的工作對我來說:

<a href="javascript:window.open(window.location.href);return true;" target="_blank">Printable version</a> 
1
<input onclick="javascrpt:window.open(window.location.href);" type="button" value="your value here" />