I want to subscribe to the close / beforeunloadevent of a window:
public OpenParameters() {
if (this.openProcessStrategyWindowHandle) {
this.openProcessStrategyWindowHandle.focus();
}
if (this.openParametersWindowHandle) {
this.openParametersWindowHandle.focus();
return;
}
this.generateUrlParametersWindow();
this.openParametersWindowHandle = this.$window.open(this.openParametersUrl + "?"
+ this.eveUtilsService.createGuid(),
"parametersWindow", "width=1280,height=750,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,copyhistory=yes,resizable=yes");
// event for closing window/tab
this.openParametersWindowHandle.onbeforeunload = () => {
this.CloseParametersInfo();
};
}
This works fine with Chrome but not with IE11 I also tried subscribing via
this.openParametersWindowHandle.addEventListener("beforeunload", () => {
this.CloseParametersInfo();
});
which results on IE in following message: "Das Object untersützt die Funktion oder Eigenschaft "addEventListener" nicht"
I found a might related topic On IE9, Win 7 window.open() returns null instead of reference of the opened window
but none of the suggested fixes helped. any ideas?
Update: what confuses: after setting and hitting a breakpoint in the code above, the code seems to work.