control functioning of back button

1
Hi  I want to know how can we control working of back button for a particular that so that it either do not perform any functioning or we can go to whatever page we want. If is there any javascript code which i can use in snippet please share with me Thanks.   Edit: I have added this JS code to a JS snippet in  another page     window.location.hash = "yes-back-button";     // Again because Google Chrome doesn't insert     // the first hash into the history     window.location.hash = "Again-yes-back-button";      window.onhashchange = function(){         window.location.hash = "yes-back-button";     } But it does not work for T&C page
asked
3 answers
0

You can use JavaScript code to achieve that.
You can add a Javascript snippet to your page and add your logic inside it.
 

 

Edit:

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

Edit 2:

 

answered
0

Hi,

To control the functionality of the back button in a Mendix application, you can use JavaScript code in a snippet. 


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

// Customize the back button behavior
window.addEventListener('popstate', function(event) {
  // Add your desired functionality here
  // For example, you can redirect to a specific page:
  window.location.href = 'path/to/your/page';
});

 

Hope it helps!!!

answered
0

This is logic for opening t&c page

answered