50

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, 'newWin', 'fullscreen="yes"')

apparently only worked for old version of IE.

Robert Moore
  • 2,207
  • 4
  • 22
  • 41
Maciej Gryka
  • 8,181
  • 4
  • 34
  • 30
  • 38
    Upvoted because, it's a perfectly legitimate question. What "you" want doesn't matter one bit if it's a corporate web-app for an intranet. – Rob Oct 05 '08 at 22:16
  • 4
    Tell it to my lecturer - that's one of the requirements for my coursework :) – Maciej Gryka Oct 05 '08 at 22:17
  • 3
    @Tanoku I agree with Rob, just because it sounds like a bad practice for a "web page", doesn't mean it is actually for a web site, have a think about the possibilities of internal applications utilising non-browsers, for exaample HTA, where a full screen window might be completely acceptable. – Scott Bennett-McLeish Oct 05 '08 at 23:16

5 Answers5

49

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.

Ilario Pierbattista
  • 3,175
  • 2
  • 31
  • 41
Geoff
  • 3,749
  • 2
  • 28
  • 24
9

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
  • 45,695
  • 27
  • 126
  • 169
8

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
  • 17,381
  • 5
  • 52
  • 70
  • 1
    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 Oct 07 '08 at 23:03
  • 1
    If you're going to tell him what to do then do so -you're right (it's a bad idea)- but at least give a **real** answer also. I have asked some questions that have gotten answers like this and it is very annoying not to have an answer. – Robert Moore Jun 27 '17 at 12:48
8

What about this, I gave width and height value to a big number and it works

window.open("https://www.w3schools.com", "_blank","toolbar=yes,scrollbars=yes,resizable=yes,top=500,left=500,width=4000,height=4000");
3

Try this. This works for me and with any link you want, or anything in the popup

Anything you chose will be shown in a PopUp window in a full screen size within a PopUp Window.

<script language="JavaScript">
function Full_W_P(url) {
 params  = 'width='+screen.width;
 params += ', height='+screen.height;
 params += ', top=0, left=0'
 params += ', fullscreen=yes';
 params += ', directories=no';
 params += ', location=no';
 params += ', menubar=no';
 params += ', resizable=no';
 params += ', scrollbars=no';
 params += ', status=no';
 params += ', toolbar=no';


 newwin=window.open(url,'FullWindowAll', params);
 if (window.focus) {newwin.focus()}
 return false;
}
</script>

<input type="button" value="Open as Full Window PopUp" onclick="javascript:Full_W_P('http://www.YourLink.com');"></input>
SeekLoad
  • 973
  • 1
  • 9
  • 33