Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
112
rated 0 times [  114] [ 2]  / answers: 1 / hits: 50245  / 14 Years ago, thu, september 9, 2010, 12:00:00

I have a popup window and in that page I have the following code in the body.



<a href=http://www.example.com target=_blank onClick=javascript:window.close()><img src=...something/></a>


The purpose is to have this popup window close when a user clicks on the image link, and to open a new page and be directed to http://www.example.com.



It works in IE and Chrome, but not in Firefox. The popup window closes but no new window is opened.



Any ideas?


More From » window.open

 Answers
2

Yes, I can repro this - interesting. setTimeout works around it:



onClick=javascript: setTimeout(window.close, 10);


I can only guess that once the window closes (which happens before the hyperlink is followed) Firefox stops processing that page.



Edit: better make it 10ms delay - with 1ms Chrome doesn't close the window.


[#95666] Monday, September 6, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
alli

Total Points: 409
Total Questions: 101
Total Answers: 105

Location: The Bahamas
Member since Tue, Apr 27, 2021
3 Years ago
alli questions
Sat, Apr 23, 22, 00:00, 2 Years ago
Mon, May 18, 20, 00:00, 4 Years ago
Tue, Mar 24, 20, 00:00, 4 Years ago
Fri, Jan 24, 20, 00:00, 4 Years ago
;