Normally, Aras Innovator will save user's preference and disconnect session automatically when user logout. In order to perform this action in background, relevant code should be triggered in onbeforeunload event and then send request to server silently.
But newer version Chrome disallow "Synchronous XHR in page dismissal", this would make above post process failed (see error message in Figure 1). Therefore, all requests in onbeforeunload event are abandoned due to this kind of policy.
Figure 1. Error in console. |
Solution
- Open "\Innovator\Client\javascript\aras_object.js".
- Add below code.
Aras.prototype.handleUnloadSoapSend = function Aras_handleUnloadSoapSend(methodName,xmlBody,url) { if (this.Browser.isCh() && window.fetch) { var soapMessage = '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">'; soapMessage += '<SOAP-ENV:Body>'; soapMessage += '<'+methodName+'>'+xmlBody+'</'+methodName+'>'; soapMessage += '</SOAP-ENV:Body>'; soapMessage += '</SOAP-ENV:Envelope>'; if (!url) url = this.getServerURL(); fetch(url,{ method: 'POST', headers: { 'AUTHUSER': encodeURIComponent(this.getCurrentLoginName()), 'AUTHPASSWORD': this.getCurrentPassword(), 'DATABASE': encodeURIComponent(this.getDatabase()), 'LOCALE': this.getCommonPropertyValue('systemInfo_CurrentLocale'), 'TIMEZONE_NAME': this.getCommonPropertyValue('systemInfo_CurrentTimeZoneName'), 'SOAPACTION': methodName }, body: soapMessage, mode: 'same-origin', keepalive: true }).then(function (response) { //Do nothing }).catch(function (error) { //Do nothing }); } else { this.soapSend(methodName,xmlBody,url); } };
- Move to line 641 and replace by below code.
this.handleUnloadSoapSend('ApplyAML','<AML>'+xml+'</AML>');
- Move to line 1034 and replace by below code.
this.handleUnloadSoapSend('Logoff','<logoff skip_unlock=\'0\'/>');
- Move to line 1036 and replace by below code.
this.handleUnloadSoapSend('Logoff','',this.UserNotification.url);
- Move to line 5752 and replace by below code.
this.handleUnloadSoapSend('ApplyItem',prefItem.xml);
Comments
Post a Comment