Window.close not working in firefox

broken image

Now that the browser thinks a script opened a page we can quickly close it in the standard way.Īnd there you have it - I told you it was simple! In case you didn't follow that, here is the complete solution in two easy steps:ġ. This opens a new page, (non-existent), into a target frame/window, (_parent which of course is the window in which the script is executed), and defines parameters such as window size etc, (in this case none are defined as none are needed). The first step is to fool the browser into thinking that it was opened with a script. I'm by no means a JavaScript expert - in fact I hardly know any at all - but I couldn't believe that this was completely impossible so I came up with the following: I searched hard and long across numerous forums and on each and every one the answer was the same - it cannot be done unless the page was opened by a script! Or at least it couldn't until I was asked to make it happen :-) Recently at work I was asked to make javascript:window.close() work in FireFox. How to close a window or tab in FireFox with Javascript