window.open not resizable, scrollable

丶灬走出姿态 提交于 2019-12-05 18:49:43

问题


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

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

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


回答1:


According to MDN you can only have 3 parameters in that function.

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

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

So you can use:

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



回答2:


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.




回答3:


Try this

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



回答4:


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')


来源:https://stackoverflow.com/questions/19118339/window-open-not-resizable-scrollable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!