Blocking browser Back function.
Application Type

Hi, I'm trying to block the browser back click function (in Reactive app)to avoid the Api recall,

I have tried by using several Js solutions but in all cases the same screen reloading or refresh is happening which is trigging the Api again that is causing issue.

so, Is there any  solution that blocks browser back navigation of a screen, without reloading or refreshing the screen like “no page action”.

Why should you want to do that? 

There are a lot of websites around the internet, where the user can press the browser back button, and everything goes wrong. 

Why not instruct your users, and investigate in building a perfect website


Hi Dharanipriya

Instead of blocking browser back button you should work for Api not to trigger again.

Can you please tell me where you are using that api in screen so I can work to restrict api execution when clicked on browser back 



Hi , 

It is not related to API actually, logically when a screen reload ,data action will be re executed so we should restrict screen reload.

Our application has around 10 pages which needs to be executed in sequence always with no option to navigate back. We need to have restriction for the user on click of back button or page refresh. For example on Facebook if I am on create post screen and try to reload or click back button it alerts me like the snippet attached below, we are looking at similar option

Hi  @Dharanipriya Bharathimohan,

Welcome to the community,

please check the below post for some reference: 

second, you can use a local variable to check whether user navigate to the screen for 1st time or 2nd time after refresh happening from back button refresh and in case of 2nd time, you can just check the value of your local variable and bypass the API/Db call whatever you are making. There is multiple ways to achieve this but depend upon the use-case. This is workaround but will work for you use-case to avoid re-execute or re-run the API call.

Hope it helps.


Manish Jawla

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