1. NOTICE: If you are using Fabrik and update to Joomla 3.10, you will need to update to Fabrik 3.10. And, if you are using Fabrik, do not upgrade to Joomla 4, we do not have a supported version ready for release. More information on a release date coming soon. Also, please note that Fabrik 3.10 will not install on any Joomla sites less than 3.8.
    Dismiss Notice

Prevent the Use of the Browser Back Button

Mar 1, 2018
Prevent the Use of the Browser Back Button
  • Because of the POST method used during a filter/search on a lists, users receive a "Document Expired" message if they try going back (using the browser back button) after viewing a details or form page.

    In addition to adding a "Go Back" form button, here is one solution to prevent that confusion, which may or may not be desirable, since preventing the use of the back button is slightly invasive.

    By use a form_x.js script in the /components/com_fabrik/js/ folder, you can prevent the use of the browser back button.
    Code (Text):

    jQuery(document).ready(function() {
      window.addEventListener('popstate', function(event) {
        if (event.state) {
          if (window.history.state == null){
            return;
          }
         window.history.pushState({},'', window.location.href);
        }
      }, false);
      window.history.pushState({},'', window.location.href);
    });
     
    Users may double click to get back, so you can duplicate these lines to prevent a double-click back: window.history.pushState({},'', window.location.href);