So i am building a ‘like’ button but i have a small problem after the user login’s in through the little window, the user has to refresh the whole page. I want it to check if the window has closed and then refresh the iframe. So I have this code to open the pop-up and i’ve been looking at the at this post for help, but it’s not helping that much.
Check if a popup window is closed
function grubber_highlight()
{
var popup = window.open("http://www.grubber.co.nz/login/", "newwindow", config="height=600,width=800, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, directories=no, status=no");
var windowloc = document.URL;
var windowlocation = (windowloc + "&highlight=t");
window.location = windowlocation;
if (popup) {
popup.onclose = function () { alert("closed"); }
}
}
I have this code to check if the window has closed and then alerts me that it has worked
if (popup) {
popup.onclose = function () { alert("closed"); }
}
The little window goes here
http://www.grubber.co.nz/login/
if anyone want’s to know.
I also want it to be able to work on most browser newer that ie8
edit
I googled a but deeper and found onunload it works on the closing but it also fires up when i open the window also…
Question
how to detect when the window is closed and then refresh the iframe
Ok thanks guy’s but i go the answer i wanted with the onunload event