Auto Close Window
Automatically close a window or tab after a set duration. Ideal for "Thank You" pages or temporary popup notices.
Click the button to open a test popup. It will close itself automatically after 3 seconds.
Copy the Script
<script>
// Function to close the current window
function closeMe() {
window.close();
}
// Set timer: 5000 milliseconds = 5 seconds
setTimeout(closeMe, 5000);
</script>
Frequently Asked Questions
Modern security policies prevent scripts from closing windows that were not opened by a script. If you typed the URL directly, the browser will likely block the close command or ask for confirmation.
Yes! This script works perfectly for closing popup windows that you created using window.open().
Modify the value in setTimeout. The time is in milliseconds (e.g., 5000 = 5 seconds).