334
Views
2
Comments
How Disable the browser back button or call a client action on click of back button
Application Type
Reactive

I tried many ways but nothing worked for me

2024-10-25 09-14-42
Christopher Bautista

Hi Mayukh,

Good day!

I haven't done any projects that I tackled seriously about the effects of the back button of the browser, but I found this post which I think would be helpful to your requirements.

Transactional apps and the BACK button | OutSystems

Hope this helps,

Kind regards,

Chris

2024-06-26 08-06-07
Ajitesh Mahapatra

Hi,

I have used the below Javascript,

window.history.pushState(null, "", window.location.href);

window.onpopstate = function (event) {

    window.history.pushState(null, "", window.location.href);

    var originalTitle = document.title;

    document.title = "";

    document.title = originalTitle;

    window.location.reload();

};

Suggestions:

- Use this code at javascript tool in OnReady Event action. (Don't use the javascript in any Client/Server actions or at Global scripts, use at OnReady event action.)

- If you want any condition according to which you want to restrict the browser you can do that before calling the javascript in OnReady action. 

- This javascript will restrict the back button of the browser. Used window.location.reload() so that the page reloads.

Please try if it can help you as well.

Thanks

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.