完成加载后,父窗口不应该聚焦 [英] Parent window should not focus after complete loading

查看:63
本文介绍了完成加载后,父窗口不应该聚焦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有这个父窗口,由于使用了标签,因此加载时间太长.
我有一个弹出窗口的按钮.

每当我在父窗口完全加载完毕之前单击弹出窗口的按钮时,
弹出窗口将打开并首先完成加载.
因此,在父窗口完成加载后,
它会移到弹出窗口的前面.

我的弹出窗口的javascript函数上已经有此代码.

  var  c_win = 窗口 .open(url,name,style);
c_win.focus();



我还需要什么才能使父窗口即使在完全加载后仍保留在后面?
哦,这仅在IE中出现.
当我使用Safari或Chrome时,父窗口保留在后面.

var c_win = window.open(url,name,style);
c_win.addEventListener(''load'', c_win.focus(), true); 


祝你好运!


So I have this parent window which takes too long to load because of the tabs.
And I have a button which pops up a window.

Whenever I click the button for the popup window before the parent window finishes loading completely,
the pop-up window opens and finishes loading first.
So after the parent window finishes loading,
it moves in front of the popup window.

I already have this code on my javascript function for the popup window.

var c_win = window.open(url,name,style);
c_win.focus();



What else do I need so that the parent window remains at the back even after it is fully loaded?
Oh, and this only occurs in IE.
When I use Safari or Chrome, the parent window remains at the back.

解决方案

Try add a listener to it instead of referencing it directly.

var c_win = window.open(url,name,style);
c_win.addEventListener(''load'', c_win.focus(), true); 


Good luck!


这篇关于完成加载后,父窗口不应该聚焦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆