可以在JavaScript中设置IE7中的标签焦点 [英] Possible to set tab focus in IE7 from JavaScript

查看:116
本文介绍了可以在JavaScript中设置IE7中的标签焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这是我今天做的事:

 
var winRef = window.open(outUrl,wName,'left ='+ wX +',top ='+ wY +',height ='+ wH +',width ='+ wW + args);
尝试{
//并非所有窗口类型都支持focus()属性。
winRef.focus();

catch(例外){
}

p>

窗口打开,但新标签没有收到焦点。 Jay,



你正在看到设计的行为。为限制恶意行为的机会,在选项卡式窗口中运行的脚本不会影响其他选项卡。



有关详细信息,请参阅 http://msdn.microsoft.com/en-us/library/ms537636.aspx : / p>

在同一个浏览器窗口中打开多个文档的能力具有一定的实用性和安全性[...]活动标签(焦点标签)不能受脚本运行在非活动或后台标签。



BR。


Is it possible to launch a new window in JavaScript using the window.Open function, then set the focus to that tab?

Here's what I'm doing today:

            var winRef = window.open(outUrl,wName,'left='+ wX +',top=' + wY + ',height=' + wH + ',width=' + wW + args);
            try {
                // Not all window types support the focus() property.
                winRef.focus();
            }
            catch (exception) {
            }

The window opens, but the new tab doesn't receive focus.

解决方案

Jay,

You are seeing designed behavior. To limit opportunities for malicious behavior, scripts running in tabbed windows cannot affect other tabs.

For more information, please see Tabbed Browsing for Developers at http://msdn.microsoft.com/en-us/library/ms537636.aspx :

"The ability to open multiple documents within the same browser window has certain practical and security implications [...] Active tabs (tabs with focus) cannot be affected by scripts that run in inactive or background tabs."

BR.

这篇关于可以在JavaScript中设置IE7中的标签焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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