JavaScript snippet to open popup window

  • 2
  • Question
  • Updated 2 years ago
  • Answered
Anyone have a snippet handy to open a non-Skuid popup window? I need to open a site in a separate browser window, but I don't want it to be a tab like the redirect action.
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb

Posted 2 years ago

  • 2
Photo of Richard

Richard

  • 394 Points 250 badge 2x thumb
Try the window.open(URL, name, specs) method. Making name equal to '_blank' should ensure a new window.

For example, the following when run should open a new window the size of the current screen with google as the webpage of choice:

window.open('https://www.google.com', '_blank', 'width=' + screen.width + ',height=' + screen.height);
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
Well, that was a lot simpler than I expected! I modified it to be so width and height were set to specific pixel amounts.
Thanks for the help!