Disable browser back/forward button or call any function on these button

0
Hi Reader, I want to disable the browser back/forward button.  If there is any way to disable them then please suggest me how can I do that? If not then can I call any on load function on these browser buttons? Thanks and Regards, Harshraj Singh  
asked
2 answers
1

A better option to consider might be to close the page(s) before opening a new one, it doesn't disable the back button but it will prevent the user ftom going back to the closed page.

answered
0

Hlw,

You can use JavaScript to disable the browser back/forward button. You can add the a code to a JavaScript file in your Mendix application that is:   

 history.pushState(null, null, location.href);
window.onpopstate = function () {
    history.go(1);
};
This code will disable the back button by pushing a null state to the history API and prevent the back button from being pressed by navigating forward in the history stack.

 

answered