Issue with window.close and chrome

mrpatg picture mrpatg · Jan 9, 2010 · Viewed 72k times · Source

I'm trying to close a child window with JavaScript, and in Firefox everything works fine but in Chrome the window doesn't close.

Here is what I'm using

$(document).ready(function() {
    if (window.opener && !window.opener.closed)
        window.opener.location = "http://www.website.com"
    window.close();
});

I tried a suggestion on google, but to no avail.

Anyone having a similar issue or know of a work-around?

Answer

Warren Benedetto picture Warren Benedetto · Mar 25, 2010

I know this question is old, but I ran into the same problem. This worked for me:

window.open('', '_self', ''); //bug fix
window.close();