Execute Javascript onWindowClose in IE11

316 views Asked by At

I am trying to call a JavaScript function when an IE11 tab and/or window Closes.

I am trying to do it using this code:

window.onbeforeunload = function(e) {//code to execute when forced close};

This code is triggered on window update and on navigation which for me is desirable and something I base my logic on. However, it seems as though it doesn't have time to execute when tab/window is forcefully closed.

I'm in the "fortunate" situation of only needing to support IE11 on this project so microsoft hacks are ok, though of course not a preferred choice as things as always might change in the future.

0

There are 0 answers