I use window.close(); to close Firefox.

I call this function after running some other code, and close it at last automatically. It works in IE but in Firefox, I have to click on Firefox anywhere once, then it will be closed, otherwise, its not closed.

Does someone know why would Firefox has such behavior? How to overcome it?
Thanks.