HTML | Window createPopup() Method

The createPopup() method in html window is used to create a pop-up window.

Syntax:

window.createPopup()

Example:



filter_none

edit
close

play_arrow

link
brightness_4
code

<html>
  
<head>
    <title>
      DOM createPopup() Method
  </title>
    <style>
        h1 {
            color: green;
        }
    </style>
</head>
  
<head>
    <script type="text/javascript">
        function show_popup() {
            var pop = window.createPopup()
            var popbody = pop.document.body
            popbody.style.backgroundColor = "lime"
            popbody.style.border = "solid black 1px"
            popbody.innerHTML = 
              "I am the pop-up, Click outside to close."
            pop.show(150, 150, 200, 50, document.body)
        }
    </script>
</head>
  
<body>
    <center>
        <h1>
          GeeksforGeeks
      </h1>
        <button onclick="show_popup()">
          pop-up!
      </button>
    </center>
</body>
  
</html>

chevron_right


Output:

Note: The Window createPopup() Method works before Internet Explorer 11.

Supported browser:

  • Google Chrome: NO
  • Mozilla Firefox: NO
  • Edge: NO
  • Opera: NO
  • Safari: NO


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



Improved By : shubham_singh



Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.