2014-01-30 52 views
0

問題陳述刷新盛大父

1)我有一個打開使用window.open彈出式B中的頁面A()。

2)乙收集一些用戶信息,並將其發送到java控制器,該控制器處理之後返回一個重定向的URL B.

3)乙然後打開此重定向URL(www.temp.com/qq/rr .jsp)使用window.open('www.temp.com/qq/rr.jsp',_ self)。

4)www.temp.com/qq/rr.jsp,用戶執行一些動作,一旦完成,www.temp.com/qq/rr.jsp

5)一旦調用頁面B. B爲基於一定條件下調用,這個彈出(頁B)應該被關閉,網頁A應頁D.

enter image description here

代替我不能使用窗口d更換網頁A。 opener.location.href。

請指教。

回答

0

這裏的關鍵是保存開窗器。一旦他們離開,這就失去了。訣竅是始終使用父窗口進行導航。而不是window.open,您將調用父窗口,並告訴IT更改子窗口的位置。

在網頁A:

var b = window.open('b.html'); 
function setChildWindowLocation(href) { 
    b.location.href = href; 
} 

在頁面B:

function getRedirectUrl() { 
    var href = ajax(); //this is obviously psuedo-code for getting the redirect url 
    window.opener.setChildWindowLocation(href); 
} 

function checkCondition(condition) { 
    if (condition) 
    { 
    //this will work, because we still have an opener 
    window.opener.location.href = 'D.html'; 
    window.close(); 
    } 
} 

在頁RR:

function goBackToPageB() { 
    window.opener.setChildWindowLocation('B.html'); 
}