When a different page is loaded, the window.unload event is not emitted.
For now I have added the following code at the top of Envjs.exchangeHTMLDocument in core.js:
try {
if (doc === window.document) {
event = doc.createEvent('HTMLEvents');
event.initEvent('unload', false, false);
window.dispatchEvent( event, false );
}
} catch (eee) {
log.debug('window unload event failed %s', eee);
//swallow
}
When a different page is loaded, the window.unload event is not emitted.
For now I have added the following code at the top of Envjs.exchangeHTMLDocument in core.js: try { if (doc === window.document) { event = doc.createEvent('HTMLEvents'); event.initEvent('unload', false, false); window.dispatchEvent( event, false ); } } catch (eee) { log.debug('window unload event failed %s', eee); //swallow }
I am note sure though whether or not this code is in the right location... see https://github.com/orslumen/env-js/commit/2c2027e775b6fc9cc78647c3eefb5777d35ddff9