I've difficult closing popup. window.close();
is working only with Chrome not IE. After doing some researches, I found this article which tells why I shouldn't use window.close()
directly in the popup to close it.
//Global var to store a reference to the opened window
var openedWindow;
function openWindow() {
openedWindow = window.open('moreinfo.htm');
}
function closeOpenedWindow() {
openedWindow.close();
}
function myReload() {
location.reload();
}
The problem is that the first time I wrote the closeOpenWindow method, I forgot to put the ()
at the end, so it was openedWindow.close;
I've fixed the problem, but I'm still getting the same error on that line.
openedWindow.close is not a function
If I delete the the entire function closeOpenedWindow()
, I get the error that closeOpenedWindow() is not a function. When I put it back, I get the previous error that openedWindow.close is not a function.
Thanks for helping
EDIT:
This is how I'm calling the function from the popupu:
function mycloseChild() {
window.opener.myReload();
window.opener.closeOpenedWindow();
}