guys!
I am working on a project with Java Javascript and when I refresh the page instead of staying in my home page, it's redirecting to login page.
I'm new to this and want to know how can I stay on same page after refreshing. I read some examples but it's not clear how to achieve this.
Example: if I'm in Settings page and press F5 or reloa, I wanna stay in Settings Page.
CodePudding user response:
.preventDefault can be used on event listeners to avoid refreshing The event listener can be anything that causes the refresh
CodePudding user response:
Typically location.reload(); would be used to refresh to the same URL, but your application logic might only allow access to particular URLs after going through certain other steps - e.g. logging in.
Without more information, your question will be almost impossible to answer.
You should try to figure out the steps that your application goes through during a bootstrap (i.e. start-up), as refreshing in a web app is effectively a restart of the JavaScript application.
