Sunday, May 12, 2024
48
rated 0 times [  54] [ 6]  / answers: 1 / hits: 73655  / 15 Years ago, sat, january 9, 2010, 12:00:00

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?


More From » google-chrome

 Answers
148

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



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

[#97881] Wednesday, January 6, 2010, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
aman

Total Points: 341
Total Questions: 92
Total Answers: 92

Location: Papua New Guinea
Member since Thu, Jul 9, 2020
4 Years ago
aman questions
Fri, Jul 10, 20, 00:00, 4 Years ago
Wed, May 27, 20, 00:00, 4 Years ago
Wed, May 13, 20, 00:00, 4 Years ago
;