2014-01-30 49 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'); 
}