简体   繁体   English

窗口焦点可加快加载弹出窗口

[英]Window focus for a faster loading pop-up

I am very new to JavaScript. 我对JavaScript非常陌生。 Kindly note that I am trying below issue in a shell which overrides many JavaScript functions. 请注意,我在覆盖许多JavaScript函数的shell中尝试以下问题。

I have an issue with focusing a window: on a single "click" action, I navigate to a new page which has two JavaScript methods which launch two external URLs which I don't own. 我在聚焦窗口时遇到了一个问题:在单个“单击”操作上,我导航到一个新页面,该页面具有两个JavaScript方法,这些方法启动两个我不拥有的外部URL。 For example I launch Yahoo.com and Google.com. 例如,我启动Yahoo.com和Google.com。 My JS launches Yahoo.com in current window (as a page navigate) and Google.com as a pop-up. 我的JS在当前窗口(作为页面导航)中启动Yahoo.com,并在弹出窗口中启动Google.com。 I WANT Google.com WINDOW TO BE FOCUSED irrespective of loading time of either URLs. 我想集中 不论任何URL的加载时间 Google.com窗口。 The major issue is I cannot use the setTimeout JS function as this function's behavior is altered within the shell and is not usable. 主要问题是我无法使用setTimeout JS函数,因为此函数的行为在外壳中已更改且无法使用。

Note: I am using a custom reusable JS function to launch external URLs and I just pass values to that method. 注意:我正在使用自定义的可重用JS函数来启动外部URL,我只是将值传递给该方法。 So I don't even have access to window object. 所以我什至没有访问窗口对象的权限。 If I can somehow achieve a time delay without using setTimeout, it will be ideal case. 如果我能以某种方式在不使用setTimeout的情况下实现时间延迟,那将是理想的情况。 If not, I will have to override that custom JS function, get access to the window object. 如果没有,我将必须重写该自定义JS函数,才能访问window对象。 Even if I have control over those window objects for external URLs, since loading times are different, setting focus to the Google window object is not always giving me the focus on Google window. 即使我可以控制那些用于外部URL的窗口对象,由于加载时间不同,所以将焦点设置到Google窗口对象并不总是使我关注Google窗口。

(IE6 & 7) (IE6和7)

You cannot guarantee the behavior you want, in general; 通常,您不能保证所需的行为。 browsers will not let you. 浏览器不会允许您。

Safari generally ignores requests to focus windows. Safari通常会忽略对窗口进行聚焦的请求。 Firefox and I think Chrome can be configured by their users ( not by your code) to allow focus requests, but by default they won't. Firefox和我认为 Chrome可以由他们的用户( 而不是您的代码)配置为允许焦点请求,但默认情况下,他们不允许。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM