0

On landing on a particular page I want to clear window history so that the user can't go back. Is there a way to empty the history stack keeping the current url intact?

  • just telling you a simple idea I don't know your requirement exactly but for this you can open that link or page in new tab.. – Adnan Tariq Jan 24 '20 at 11:13
  • @AdnanTariq basically in mobile web view once a user reaches a certain confirmation page I want to clear history so that when user click back he goes back to the app instead of the previous page. – Hammad Uzair Jan 24 '20 at 11:54

1 Answers1

1

It is not currently possible to clear browsers history at the time of writing this post: https://stackoverflow.com/a/20064623/4241624

If you can bump the user to a new window however it will start as page one with no history.

this can be accomplished with HTML

<a href="https://some.link/page" target=_blank>Click me</a>

or with javascript:

window.open("https://some.link/page");
Michael Nelles
  • 5,426
  • 8
  • 41
  • 57