Window.Focus()无法正常工作

This is my code:

var opened='';
var opened1='';    
var i=0;
var j=0;
$( "#dialog-confirm" ).dialog({

 resizable: true,
 modal: true,
buttons: {

   "Yes": function() {

          $( this ).dialog( "close" );
          $.ajax({
               url: urlDetail,
               type: 'POST',
               data: {page_title: proTitle, page_url: proUrl, product_description: proDescription, product_image: proImage, web: proHost, product_price: proPrice, purchased: 'yes' },
          })
          .done(function() {
              console.log("success");
               if(j==0){
                  opened1=window.open(urlDetail,"Spost1","status=1,width=870,height=530");
                  j=1;
           }else{
               opened1=window.open(urlDetail,"Spost1","status=1,width=870,height=530");
               opened1.focus(); 
                 } 
          })
          .fail(function() {
              console.log("error");
          })
          .always(function() {
              console.log("complete");
          }); 
   }
 }

});

So, here focus to already opened window is not working.

focus is not working in my case, when window is already opened.

查看全部
weixin_33712987
weixin_33712987
2015/08/20 06:27
  • ajax
  • javascript
  • 点赞
  • 收藏
  • 回答
    私信

0个回复