Answers for "javascript close window"

8

javascript close current tab

window.close();//closes the current browser tab
Posted by: Guest on August-05-2019
6

javascript close window

<!DOCTYPE html>
<html>
<body>

<button onclick="openWin()">Open "myWindow"</button>
<button onclick="closeWin()">Close "myWindow"</button>

<script>
var myWindow;

function openWin() {
  myWindow = window.open("", "myWindow", "width=200,height=100");
  myWindow.document.write("<p>This is 'myWindow'</p>");
}

function closeWin() {
  myWindow.close();
}
</script>

</body>
</html>
Posted by: Guest on April-06-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language