Open In App

HTML | Window createPopup() Method

Improve
Improve
Like Article
Like
Save
Share
Report

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

Syntax:

window.createPopup()

Example:




<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>


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


Last Updated : 11 Oct, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads