fix error on window closing in Chrome 80+

caused by Chrome 80+ no longer allowing to send a synchronious ajax request from beforeunload handler, using sendBeacon (async request with keepalive=true) instead
This commit is contained in:
Ralf Becker
2020-03-02 10:43:19 +01:00
parent 1bbfb13421
commit 65294a3e19
4 changed files with 24 additions and 13 deletions

View File

@ -285,9 +285,9 @@ etemplate2.prototype.bind_unload = function()
{
this.destroy_session = jQuery.proxy(function(ev)
{
var request = egw.json("EGroupware\\Api\\Etemplate::ajax_destroy_session",
[this.etemplate_exec_id], null, null, false);
request.sendRequest();
// need to use async === "keepalive" to run via beforeunload
egw.json("EGroupware\\Api\\Etemplate::ajax_destroy_session",
[this.etemplate_exec_id], null, null, "keepalive").sendRequest();
}, this);
if (!window.onbeforeunload)