window open callback

Posted by w3diy - 5 months ago

window.open callback

Set a callback function to a new window in javascript

reference holder only

var RunCallbackFunction = function() { }; 

window.open callback event

You may call a parent function from child window this way:

window.opener.getProducts()

To call a child function in parent window: has a function on window called "getProducts"

var w = window.open(somelocation,''); 
w.getProducts();

This JavaScript code :

capture the close event of an opened window by window.open() in JavaScript.

var getProducts = window.open("/get_products.html");

getProducts.onbeforeunload = function () {
    // processing event here
    alert("new window closed");
}