Jquery window.focus无法处理firefox中已打开的窗口

Jquery window.focus无法处理firefox中已打开的窗口,jquery,Jquery,我的代码不适用于firefox,但同样的代码适用于chrome。 这是我的密码: $( "#confirm" ).dialog({ resizable: true, modal: true, buttons: { "Yes": function() { newWindow = window.open(url,"myWindow","status=1,width=870,height=530

我的代码不适用于firefox,但同样的代码适用于chrome。 这是我的密码:

$( "#confirm" ).dialog({

        resizable: true,
        modal: true,
        buttons: {

            "Yes": function() {
                newWindow = window.open(url,"myWindow","status=1,width=870,height=530");
                newWindow.focus();

                $( this ).dialog( "close" );
             }
        }
   });

如果窗口已经打开,我想聚焦。但不能在firefox中工作。

由于某些原因,当前窗口正在获得焦点。要解决此问题,请在focus下面再添加一个函数,如下所示:

$( "#confirm" ).dialog({

    resizable: true,
    modal: true,
    buttons: {

        "Yes": function() {
            newWindow = window.open(url,"myWindow","status=1,width=870,height=530");
            newWindow.focus();
            newWindow.moveTo(0,0);

            $( this ).dialog( "close" );
         }
    }
});

因此,将moveTo0,0相加;这将再次将焦点集中到窗口,而不会影响窗口。

@Praveen该解决方案在我的情况下不起作用。好的,那么到底发生了什么?@Praveen如果您知道该解决方案,请告诉我上述代码是在ajax成功后调用的。那么,这是问题吗?不,那没关系。你试了什么?你说你看到了重复的问题,解决方案不起作用。你试了什么?