javascript window.open 不可调整大小,可滚动

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19118339/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 14:26:30  来源:igfitidea点击:

window.open not resizable, scrollable

javascriptwindow.open

提问by Varun

I tried window.openand want the javascript to open a new browser with new url and wants the new window to be resizable and scrollable

我尝试window.open并希望 javascript 打开一个带有新 url 的新浏览器,并希望新窗口可以调整大小和滚动

i tried

我试过

window.open("someurl", '_blank','windowOpenTab', 'scrollbars=1,resizable=1,width=1000,height=580,left=0, top=0');

Edit1: tried window.open(url, '_blank','windowOpenTab', 'scrollbars=1,resizable=1,width=1000,height=580,left=0,top=0');still no luck

编辑1:尝试window.open(url, '_blank','windowOpenTab', 'scrollbars=1,resizable=1,width=1000,height=580,left=0,top=0');仍然没有运气

read about window.open from http://www.javascript-coder.com/window-popup/javascript-window-open.phtmlbut no luck :(

http://www.javascript-coder.com/window-popup/javascript-window-open.phtml阅读 window.open但没有运气:(

回答by Sergio

According to MDNyou can only have 3 parameters in that function.

根据MDN,该函数中只能有 3 个参数。

window.open(strUrl, strWindowName[, strWindowFeatures]);

Demo here- I droped the '_blank'and made a demo with small window just to make the scrollbar showup.

演示在这里- 我放弃了'_blank'并制作了一个带有小窗口的演示,只是为了显示滚动条。

So you can use:

所以你可以使用:

window.open("someurl", 'windowOpenTab', 'scrollbars=1,resizable=1,width=1000,height=580,left=0,top=0');

回答by Ravee Sunshine

Try this

试试这个

 function openPopupWindow(){ 
window.open("http://example.com","popup","width=668,height=548,scrollbars=yes, resizable=yes");     
 }

回答by Gurminder Singh

Change

改变

 window.open("someurl", '_blank','windowOpenTab', 'scrollbars=1,resizable=1,width=1000,height=580,left=0, top=0');

to

 window.open("someurl", 'windowOpenTab', 'scrollbars=1,resizable=1,width=1000,height=580,left=0, top=0');

Just remove the _blank, FIDDLE.

只需删除_blankFIDDLE

回答by Vinod Louis

Try this

试试这个

popupWin = window.open('http://webdesign.about.com/',
'open_window','menubar, toolbar, location, directories, status, scrollbars, resizable,
dependent, width=640, height=480, left=0, top=0')