10

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 :(

Varun
  • 5,001
  • 12
  • 54
  • 85

4 Answers4

23

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');
Sergio
  • 28,539
  • 11
  • 85
  • 132
  • i want to make sure it opens a new window always and there is never a case that it opens a new tab – Varun Oct 01 '13 at 14:24
  • @Varun, I'm not sure that is cross browser compat. Check here http://stackoverflow.com/questions/4907843/open-url-in-new-tab-using-javascript – Sergio Oct 04 '13 at 08:04
  • 1
    Watch how you're spelling resizable, I got caught out for a head-banging 10 minutes by misspelling it resizeable. – Bob Jan 03 '17 at 15:55
  • In my case, I had to use this and add to force the scroll bar on the pop-up window. as @Bob said, watch out with spelling "resizeable" – Giancarlo Benítez Mar 01 '18 at 16:56
0

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.

Gurminder Singh
  • 1,755
  • 16
  • 19
0

Try this

 function openPopupWindow(){ 
window.open("http://example.com","popup","width=668,height=548,scrollbars=yes, resizable=yes");     
 }
Ravee Sunshine
  • 386
  • 1
  • 5
  • 15
-1

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')
Vinod Louis
  • 4,812
  • 1
  • 25
  • 46