0

I have a problem in getting a JavaScript window centred in Google Chrome, I have found a solution HERE but it's creating a new JavaScript function that calls the Window.Open.

How to do get it centred in all browsers using Window.Open Only?

<asp:ImageButton runat="server" ID="imgNew"  onclientclick="window.open('http://www.google.com','_blank','channelmode =1,scrollbars=1,status=0,titlebar=0,toolbar=0,resizable=0,width=400,height:300');" />
Community
  • 1
  • 1
Alaa Alweish
  • 8,904
  • 16
  • 57
  • 84

1 Answers1

0

For fixed Width and height Try:

window.open('http://www.google.com','_blank', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+400+', height='+300+', top='+ Number((screen.height/2)-(300/2)) +', left='+  Number((screen.width/2)-(400/2)) );return false;

On ImageButton with a disabled Postback:

<asp:ImageButton runat="server" ID="imgNew" onclientclick="window.open('http://www.google.com','_blank', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+400+', height='+300+', top='+ Number((screen.height/2)-(300/2)) +', left='+  Number((screen.width/2)-(400/2)) );return false;" PostBackUrl="javascript:void(0);" />
Alaa Alweish
  • 8,904
  • 16
  • 57
  • 84
  • To force Chrome to open a full screen window use: `window.open('http://www.google.com','_blank', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+screen.width+', height='+screen.height+', top='+ Number(0) +', left='+ Number(0) );` – Alaa Alweish Nov 26 '13 at 18:49