2012-11-19 312 views

回答

0

您可以使用window.opener獲取對打開當前窗口的窗口的引用。不知道這是你以後的樣子。當使用window.open它會產生一個新的窗口,不知道你是什麼意思的「在同一屏幕上打開新窗口」。

+0

我們可以在window.open(「About.html」,'_self')的同一個窗口中打開新的屏幕。而在新的屏幕上我想要上一頁的網址。 –

+0

你能傳遞一個參數到新的頁面嗎? – CyberDude

0

使用Window.opener你可以得到它,就像

var win=​window.open('http://heera.it')​; 
console.log(win.opener.location.href); // will output the url 

Example.

+0

其實我想通過使用window.open(「About.html」,'_self')在同一個窗口中打開新的屏幕。所以在此之後,當我使用window.opener.location.href沒有給任何值 –

3

您可以使用window.opener.location.href,它會給你父頁面的URL,從中打開了一個新窗口。

相關問題