我正在尝试在新网址中打开pdf并将用户重定向到主页。但是这2.和 3."如果"块的行相互阻止。页面正在重定向到主页,但 window.open() 不起作用。
if(result.status == 'success'){
hideSplashScreen();
window.location.href = webContextPath+"/user/userhome";
window.open(result.message, '_blank').focus();
}
实际上window.location.href = webContextPath+"/user/userhome";
离开了当前页面,所以window.open
可能永远不会运行......
您是否尝试过先呼叫window.open(result.message, '_blank').focus();
,然后再呼叫window.location.href = webContextPath+"/user/userhome";
?
翻转序列:调用第一个窗口.open(result.message, '_blank').focus();
firstif(result.status == 'success'){
hideSplashScreen();
window.open(result.message, '_blank').focus();
window.location.href = webContextPath+"/user/userhome";
}