185
Views
4
Comments
disable browser back button in Outsystems Reactive app
Question

Hi All

i want to disable browser back button in my application.i am using mbelow javascript but it is not working.can anyone please help me.

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

window.onpopstate = function(event) {

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

    var tl =  document.title;

    document.title="";

    document.title= tl;

};

2024-12-10 04-40-04
Gitansh Anand

Hi @Arkyadeep Bharadwaj, please look at this documentation and see if it helps, Navigation.

Thanks

Gitansh Anand

2023-06-14 08-52-52
Arkyadeep Bharadwaj

do u have any sample?

2023-04-16 15-25-31
Krishnanand Pathak

Hi @Arkyadeep Bharadwaj ,

Please check the oml attached.

Regards
Krishnanand Pathak

DisableBackButton.oml
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.