Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Open and close a browser window and refresh parent page using JavaScript
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset=utf-8 />
- <title>Test Page</title>
- <script>
- function closeOnLoad(myLink)
- {
- var newWindow = window.open(myLink, "connectWindow", "width=600,height=400,scrollbars=yes");
- setTimeout(
- function()
- {
- newWindow.close();
- location.reload();
- },
- 1000
- );
- return false;
- }
- </script>
- </head>
- <body>
- <p><a href="#" onclick="javascript:closeOnLoad('http://www.google.com/');">Click to open popup</a>; it will close automatically after five seconds.</p>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment