JavaScript Popup Chrome'另存为'停用?为什么? [英] JavaScript Popup Chrome 'save as'-deactivated? Why?
本文介绍了JavaScript Popup Chrome'另存为'停用?为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
函数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 +',可调整大小=是,滚动条=是,菜单栏=是,工具栏=是,标题栏=是,热键=是,状态=是,依赖=没有,位置= 1' );
popupWindow.document.write(site);
返回popupWindow;
}
当我右键单击新窗口时,另存为-dialog在Chrome中停用。
如何启用它?我做错了什么?
code> 1 不是是
。这应该是阻止Chrome将弹出窗口视为新窗口的原因。 另外, open()
需要参数按以下顺序:
window.open(URL,名称,规格,替换)
所以试试:
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')
I am opening an popup in Javascript with:
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;
}
When I right click the new window, the "save as"-dialog is deactivated in chrome.
How can I enable it? What am I doing wrong?
解决方案
the attribute status
should be 1
not yes
. This should be what is preventing Chrome from treating the popup as a new window.
Also, open()
takes parameters in this order:
window.open(URL,name,specs,replace)
So try:
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')
这篇关于JavaScript Popup Chrome'另存为'停用?为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文