JavaScript Save As Pop-up Chrome - Deactivated? What for?

I open a popup in 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; } 

When right-clicking in a new window, "save as" -dialog is deactivated in chrome.

How to enable it? What am I doing wrong?

+4
source share
1 answer

the status attribute must be 1 not yes . This should be what prevents Chrome from processing the pop-up in a new window.

In addition, open() takes parameters in the following 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') 
-1
source

Source: https://habr.com/ru/post/947044/


All Articles