0

Hi I am trying to figure out if there is any way to disable the browser navigation bar so that the user is not able to reload the url or unable to the click on browser reload . I tried to find the solution but I could only see like this below in most of the sites .

window.open('URL', 'null', 'width=900,height=750,toolbar=no,scrollbars=no,location=no,resizable =no');
    window.moveTo(0, 0);

I am trying to find the solution using Java Script or JQuery and learn in the process. In my application after the first page and after click on submit button then the second page is OTP page and I want to not show the navigation bar or not to allow the user to reload the page while entering the OTP . I am hardly find the solution and any help would be appreciated.

Mahi
  • 553
  • 2
  • 7
  • 23
  • My browser is configured to _never_ let site authors open a popup without a navigation bar. _"so that the user is not able to reload the url or unable to the click on browser reload"_ - even if you did manage to hide the navigation bar and browser menus, [F5] or [command]+[r] will still reload the page ... You are on completely the wrong path here, by trying to fix symptoms, instead of the actual problem. _Why_ is a reload a problem for your site/app? Fix whatever _that_ issue is, instead of trying to find workarounds that won't _ever_ reliably work. – CBroe Jul 15 '22 at 10:31
  • @Cbroe : Reload is problem because user is able to use the expired otp when clicked on browser reload and I am trying to disable the browser reload and find the solution through client side validations instead of server side validations . – Mahi Jul 15 '22 at 10:35
  • _"because user is able to use the expired otp when clicked on browser reload"_ - why? Expired should mean expired. _"find the solution through client side validations instead of server side validations"_ - trying to validate an OTP on the client side, that does not make much sense to me to begin with. What would be the point? At some point, you will want to report the client's login status back to the server, no? So I could just fake the request that does _that_ then. – CBroe Jul 15 '22 at 10:38
  • @CBroe : In OTP Page I have set timer and after timeout only resend option will be available. So in this OTP Page , the user shouldn't be allowed to use browser navigation bar like reload the page or reloading the url. – Mahi Jul 15 '22 at 10:42

1 Answers1

0

Most of the browsers dont have that feature or has that feature but not turned on due to user experience concerns. It could be easily exploited by hackers so its usually not possible for safety concerns

Mr. Innovator
  • 95
  • 1
  • 6
  • I am trying to disable the browser navigation bar only on the OTP page. It should be like user is able to see the browser navigation bar but shouldn't able to edit the url or reload when clicked. – Mahi Jul 15 '22 at 10:38
  • Theres just no feature to do that, but you can alert the user if the user hits refresh using window.onbeforeunload, source: https://stackoverflow.com/questions/3527041/prevent-any-form-of-page-refresh-using-jquery-javascript – Mr. Innovator Jul 15 '22 at 10:52
  • Is there any way to disable the browser navigation bar on page load using Javascript or Jquery. – Mahi Jul 15 '22 at 11:01
  • browsers just dont let developers do that, it poses security risk if that was possible – Mr. Innovator Jul 15 '22 at 11:03