views:

1782

answers:

3

Is there a way to make a popup window maximised as soon as it is opened? If not that, at least make it screen-sized? This:

window.open(src, fullscreen="yes")

apparently only worked for old version of IE.

+9  A: 

Use screen.availWidth and screen.availHeight to calculate a suitable size for the height and width parameters in window.open()

Although this is likely to be close, it will not be maximised, nor accurate for everyone, especially if all the toolbars are shown.

Geoff
+4  A: 

More than bad design - this "feature" is a recipe for UI disaster. There were a number of malicious web sites which exploited the full screen view features in JavaScript to hijack browser windows and display a screen indistinguishable from the user's desktop. While there may still be a way to do this, please for the love of all things decent, do not implement this.

Rob Allen
Couldn't agree more!
roosteronacid
Other side effects: http://dorward.me.uk/tmp/fullscreen.jpeg
David Dorward
Don't worry about my website actually having this implemented - as I mentioned I've only done it to satisfy lecturer's requirements :) Thanks for the warning though!
maciej.gryka
+1  A: 

What about this:

var popup = window.open(URL);
if (popup == null)
   alert('Please change your popup settings');
else  {
  popup.moveTo(0, 0);
  popup.resizeTo(screen.width, screen.height);
}
Ray