Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show fullscreen popup window in javascript?

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.

like image 649
Maciej Gryka Avatar asked Oct 05 '08 22:10

Maciej Gryka


People also ask

How do I get a pop up window to open full screen?

Full-screen can be activated for the whole browser window by pressing the F11 key.

What is the Javascript command for a popup window?

The syntax to open a popup is: window. open(url, name, params) : url. An URL to load into the new window.


2 Answers

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.

like image 127
2 revs, 2 users 80% Avatar answered Oct 14 '22 12:10

2 revs, 2 users 80%


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); } 
like image 36
Ray Avatar answered Oct 14 '22 13:10

Ray