这是我的代码:
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");
});
}
}
});
所以,这里专注于已打开的窗口不起作用。
当窗口已经打开时,焦点在我的情况下不起作用。