Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

179
Views
How to stay on the Current Page in JavaScript after refresh

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.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

.preventDefault can be used on event listeners to avoid refreshing The event listener can be anything that causes the refresh

about 4 years ago · Juan Pablo Isaza Report

0

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.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!