Html javascript to open new window and close current window?

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

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.

It works, thanks, I guess you are right it probably just stop execute other operation once it is closed. Make sense ~ – Eatdoku Sep 9 '10 at 23:23.

When you add some functionality to an element's click event via javascript, that functionality is executed before the default click event (in this case, opening a new page), in order to allow for the possibility of intercepting and overriding the default event. The default behavior will only execute when and if the event returns a boolean value of true. In this case, the additional functionality would be to close the window and my guess is that Firefox chooses to interpret this as "we're all done here", so the click event never returns true, and thus the new page never gets opened.

Evgeny's suggestion of using a short timeout would allow the click event to return true before the window is closed, thus allowing the new window to open.

I don't remember exactly, but it can be turned off in about:config.

It does support it, I removed the onclick event then it will open new window. But I have to find a way to close the current window thou. – Eatdoku Sep 9 '10 at 23:06.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions