After Logout user will able to see the last page before logout

I am having issue one issue like, when user clicks on Logout button in SuiteCRM application, he is redirecting to Login page. But if the user click on the browser’s back button he is able to see the page before logout for a fraction of second OR a second.

I tried with the disabling the browser back button but its not working for me.
I tried with bellow code in side login.js file.

window.history.forward(-1);

history.pushState(null, null, location.href);
window.onpopstate = function () {
   history.go(1);
};

$(document).ready(function () {
    function disableBack() { window.history.forward() }
    window.onload = disableBack();
    window.onpageshow = function (evt) { if (evt.persisted) disableBack() }
});


history.pushState(null, document.title, location.href);
window.addEventListener('popstate', function (event)
{
  history.pushState(null, document.title, location.href);
});

Video link for the issue : https://www.screencast.com/t/whHbs6C5Io47

I am using SuiteCRM Version 7.11.8

Please suggest on this.

Thanks in advance

1 Like

@ciwarkar

You can test logichook after_logout or before_logout . The information here:

1 Like

Hi,

As our mate suggested use any logic hook and simply use the below code in respective custom javascript file,

$(document).ready(function() {
	history.pushState(null, null, location.href);
    window.onpopstate = function () {
        history.go(1);
    };
});

Try like this, hope you may resolve the issue.

One thing to take into consideration is that many users will just close the browser. That won’t be catch by the logichook.