I'm trying to call a URL (like a tag) from java script code, I know that there is :
window.open(url)
and
location.href=url
but on top of that, I want to set a callback function to be called when the called url is closed.
for example I want to create a button, when it clicked it call stackoverflow web site, and then when I close stackoverflow, I want an alert to be launched
Edit
I tried the following solutions but it is not exactly what I wanted .
here is an example of what I want :
window.open( "http://stackoverflow.com");
//I know this event doesn't exist
window.onclose=function(){
alert("Hello! I am an alert box!");
}
}