基本上这是我的代码(Authenticator.jsp):
window.location.replace("Login.html"); // replace method also takes care of history
window.open ("Main.html", "Welcome logged in user");
预期行为:
- 一旦用户登录,我们基本上会在弹出窗口中打开 Main.html。
- 当前窗口必须指向 Login.html,并且 main 应在弹出窗口中打开。
实际行为:
- Main.html 在弹出窗口中打开
- Authenticator.jsp 切换回 Login.html,但是此窗口获得焦点!并显示在我的弹出窗口前面!!
这个问题有解决办法吗?此行为在 IE6 中出现(我没有检查 IE7 和 IE8),在 Firefox 和 chrome 中不会出现
最佳答案
我认为你应该打电话
window.location = "Login.html"
然后将调用移至
window.open("Main.html","欢迎登录用户");
进入Login.html页面的onload事件。
关于javascript - 同时弹出并更改位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1788475/