0

This is kind of a dumb question, but what is the command to open a popup window in JS? I know that window.open works, but on chrome, it shows the tabs, which I have seen in popups not existing. It should just show the address at the top. Hopefully I expressed this question correctly.

EDIT:

In the third parameter of window.open, you can specify "popup=true".

henxdl
  • 118
  • 14
  • window.open( "https://www.google.com/", "mozillaWindow", "popup,left=100,top=100,width=320,height=320" ); It will open popup window with just url https://developer.mozilla.org/en-US/docs/Web/API/Window/open – Ronak Jan 25 '23 at 15:35
  • 1
    Thank you! This was the exact answer I was looking for! – henxdl Jan 25 '23 at 15:37
  • Does this answer your question? [Open URL in new window with JavaScript](https://stackoverflow.com/questions/14132122/open-url-in-new-window-with-javascript) – Kurt Van den Branden Jan 25 '23 at 15:40

2 Answers2

1

Default behavior is to open in a new tab. However, using the third parameter windowFeatures in the window.open(...); function will allow you to set parameters to force the request to open in a new popup with the minimal UI elements that you're requesting. For example:

window.open("{url}", "_blank", "popup=yes");

Reference Documentation: window.open()

War10ck
  • 12,387
  • 7
  • 41
  • 54
1

Specifying the popup option in the windowsFeatures (third) parameter should produce the result you want.

window.open('', '', 'popup=true')

Learn more about window.open from MDN, here.

Hope this helps.

damonholden
  • 1,062
  • 4
  • 17