Sunday, May 19, 2024
137
rated 0 times [  139] [ 2]  / answers: 1 / hits: 168087  / 12 Years ago, tue, april 24, 2012, 12:00:00

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)


More From » internet-explorer

 Answers
12
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.


[#86020] Monday, April 23, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
deving

Total Points: 26
Total Questions: 94
Total Answers: 103

Location: Serbia
Member since Tue, Jul 26, 2022
2 Years ago
;