对于一个小应用程序,我打开我的脚本中的几个窗口/标签.浏览器是打开窗口还是选项卡当然不在我手中.
但是,我保留了对新创建的window对象的引用,并且我确实从另一个窗口"远程"更改了它们的内容.这一切都发生在同一个document.domain没有xss问题.
问题是,我无法可靠地focus创建窗口/标签.由于我正在为客户编写一个非常具体的应用程序,因此我只将Firefox作为浏览器.我有一个选择当然只是做一个remoteWindow.alert('foobar');将窗口/标签放在前面,但这是非常难看的不是它.
我找到了这个答案如何将窗口/标签聚焦为alert()?
并且据说,Firefox有一个允许脚本焦点的选项.所以最后我的问题是,那个选项是什么?我搜索了about:config"标签"和"焦点"但没有发现任何相关内容.
如何配置?
大家好我正在开发一个聊天应用程序...我有多个聊天窗口...我想知道哪个windw包含新消息...我有以下代码..
function getCount()
{
$.ajax({
type: "POST",
url: baseUrl + '/Chat/count',
data: "chat_id=" + document.ajax.chat_id.value,
success: function(msg){
if(msg == 'new1') {
self.focus();
//window.focus();
}
}
});
}
Run Code Online (Sandbox Code Playgroud)
如果操作员同时参加聊天....
例如,url就像 http:// localhost/nisanth/admin/Chat/index/chatId/15 http:// localhost/nisanth/admin/Chat/index/chatId/16
http:// localhost/nisanth/user/Chat/index/chatId/15 http:// localhost/nisanth/user/Chat/index/chatId/16
如果user 16输入消息我需要关注
http://localhost/nisanth/admin/Chat/index/chatId/16
Run Code Online (Sandbox Code Playgroud)
这段代码可以正常使用IE而不是在Firefox中...请给我一个解决方案...上面的代码是在相同的HTML中