0

I have tried window.open() and resizeTo(screen.width,screen.height) but it is not opening in maximize view.

Please help with the relevant code.

Not A Bot
  • 2,474
  • 2
  • 16
  • 33
Rajat
  • 11

3 Answers3

0

you can resizeTo() only the window, that was created by window.open(). First of all you should create and write to any var your window instance. And after that you can use its methods. Here is an example:

myExternalWindow = window.open("http://myurl.domain", "myWindowName", "resizable");
myExternalWindow.resizeTo(screen.availWidth,screen.availHeight);

Good luck!

Dima
  • 79
  • 6
  • 2
    JavaScript has no way to minify or maximize a window. These OS-level functions are hidden from Frontend-developers. [source](https://javascript.info/popup-windows) or [another-source](https://stackoverflow.com/a/25797203/9075864) – Dima Jan 23 '20 at 11:09
-1

Try window.open with screen.availHeight / screen.availWidth.

e.g.

window.open(src, "newWin", "width="+screen.availWidth+",height="+screen.availHeight)
DavidR2106
  • 132
  • 6
-1

The size of the window (I think you mean a popup window) you'll open can be set through the attributes width and height like below:

<a href="your-http-address.php" onclick="window.open(this.href,'targetWindow',
  'toolbar=no,
   location=no,
   status=no,
   menubar=no,
   scrollbars=yes,
   resizable=yes,
   width=your_width,
   height=your_height');
 return false;">Open PopUp Window</a>

Where the placeholder your_width and your_height specify the popup dimensions. To make the popup cover the entire screen dimensions, just use screen.availWidth and screen.availHeight.

Jazzpaths
  • 645
  • 5
  • 9