0

I have a problem on my online platform. If a user logs in the member area, I hide unnecessary menue items via access-list. It works pretty fine, but when the user, uses browser back button once he is logged in and last page is one of the hide one it generates an error because the user has no access to this page when he logged in.

So I need a way to perform a simple page reload on the login landing page if the browser back is pressed. Or the browser Back button is disabled as a whole on that specific page.


Im sorry I have no code to share, I`m working on a joomla portal and after the LogIn Module redirects me to the login landing-page I just have the possibility to place a script in the header or body of the landing page that does the asked action.

Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

0

Try this:

<script>    
history.pushState(null, null, document.URL);
   window.addEventListener('popstate', function () {
   history.pushState(null, null, document.URL);
   location.reload();
});
</script>
catbadger
  • 1,662
  • 2
  • 18
  • 27