How to open maximized window with Javascript?

internet-explorer, javascript

Solution

var params = [
    'height='+screen.height,
    'width='+screen.width,
    'fullscreen=yes' // only works in IE, but here for completeness
].join(',');
     // and any other options from
     // https://developer.mozilla.org/en/DOM/window.open

var popup = window.open('http://www.google.com', 'popup_window', params); 
popup.moveTo(0,0);

Please refrain from opening the popup unless the user really wants it, otherwise they will curse you and blacklist your site. ;-)

edit: Oops, as Joren Van Severen points out in a comment, this may not take into account taskbars and window decorations (in a possibly browser-dependent way). Be aware. It seems that ignoring height and width (only param is `fullscreen=yes`) seems to work on Chrome and perhaps Firefox too; the original 'fullscreen' functionality has been disabled in Firefox for being obnoxious, but has been replaced with maximization. This directly contradicts information on the same page of https://developer.mozilla.org/en/DOM/window.open which says that window-maximizing is impossible. This 'feature' may or may not be supported depending on the browser.

Problem

I'm using Javascript's `self.open()` to open a link in a new window and i'd like that window to be maximized. I tried the `fullscreen=yes` option, which really doesn't do what I want. I am using below code: ``` self.open(pageLoc,popUpName,'height=1600,width=1800,resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes,location=yes'); ``` If i also mention `fullscreen=yes`, then window opens up like you press F11. But i don't want it that. What i want is when i double click on IE and click maximize icon on top right corner. As i have given the `height` and `width` value so large, it is close to maximized window but not actual maximized window. (the reason i am saying this because even now if i click maximize button, it further expans little bit)

Original source

Related problems