我在Javascript中打开一个弹出窗口:
function popup(title,w,h,site) {
x = screen.availWidth/2-w/2;
y = screen.availHeight/2-h/2;
var date = new Date()
var ticks = date.getTime();
var popupWindow = window.open(
title,"popup"+ticks,'width='+w+',height='+h+',left='+x+',top='+y+',screenX='+x+',screenY='+y+',resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes,titlebar=yes,hotkeys=yes,status=yes,dependent=no,location=1');
popupWindow.document.write(site);
return popupWindow;
}
当我右键单击新窗口时,“另存为”-dialog在chrome中被停用.
我该如何启用它?我究竟做错了什么?
解决方法:
属性状态应为1而不是是.这应该是阻止Chrome将弹出窗口视为新窗口的原因.
此外,open()按以下顺序获取参数:
window.open(URL,name,specs,replace)
所以尝试:
window.open("about:blank", title, 'width='+w+',height='+h+',left='+x+',top='+y+',screenX='+x+',screenY='+y+'resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes,titlebar=yes,hotkeys=yes,status=yes,dependent=no,location=1')