So OK, the following definitely works:
w=window.open(url);
w.onload=function (){};
But then, when I want to open a second new window (where the first new window is already processed by the function(){},i.e. becomes garbage to be collected) replacing the first new window, I tried the following which utterly fails:
w.location.href=url;
w.onload=function (){};
I am just wondering is there a solution to this? Since onload does have the power over a child window, it should in someway have the power over a child-window-replacement.