Skip to content

JavaScript open popup window

  • by

Use JavaScript’s method to open the popup window in JavaScript. Popup windows are different from simply opening a new browser window.

open(url, target)
open(url, target, windowFeatures)

JavaScript open popup window

Simple example code calls the function, passing the URL as a parameter, whenever you want to open a popup window.

<!DOCTYPE html>
  <input type="button" value="Open Popup" onclick="basicPopup('')">

    function basicPopup(url) {
      popupWindow =,'popUpWindow','height=500,width=500,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes');



JavaScript open popup window

Javascript to open link in a new pop-up window

<a href="//"  class="social_share_link"
onclick="return !, 'somesite', 'width=500,height=500')"

Do comment if you have any doubts or suggestions on this JS topic.

Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version

Leave a Reply

Your email address will not be published. Required fields are marked *