Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Closing popup window after 3 seconds

I need to close the popup windows in the following after 3 seconds. How do I do it.

<map id="ImgMap0" name="ImgMap0">
                  <area alt="" coords="127, 22, 20" alt="" title="click here" href="includes/popup1.htm" onclick="javascript:void window.open

('includes/popup1.htm','1366002941508','width=500,height=200,left=375,top=330');return false;" shape="circle" />
</map></p>
like image 561
user964377 Avatar asked Apr 21 '13 01:04

user964377


People also ask

How do I close the HTML window automatically?

open("URL_HERE", "my_window", "height=100,width=100"); and we need to close the second page automatically after login success. Okay so in the popup use window. close() to close the window like I mentoined in my example.

How do you fix Scripts may close only the windows that were opened by it?

Scripts may close only the windows that were opened by it. A workaround now is redirect user to another page rather than close the window, you could redirect user to a notification page to show "The items has been closed successfully" using window. location. href="PageUrl".


1 Answers

Use a setTimeout, for example:

var win = window.open("http://www.google.com", '1366002941508','width=500,height=200,left=375,top=330');

setTimeout(function () { win.close();}, 3000);

Sample fiddle: http://jsfiddle.net/N5rve/

like image 129
John Koerner Avatar answered Oct 02 '22 08:10

John Koerner