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

144
Views
How manual url access can be prevented in Vue 2

I use the story mode in vue router (to expose the URL to the user), but I need to prevent the user from manually changing it, unless accessing a URL that they have already visited (from an app redirect).

If I have the following route with id parameter:

 { path: '/user/:id', name: 'User', component: User }

If the user accesses http://example/user/1 and http://example/user/2 from the application, he could access the 2 URLS manually, but if he changes the 'id' 2 to 3 (http://example/user/3) should not be able to access.

Although vue-router limits that the content is not modified if the user changes user/2 to user/3, when the user refreshes the page with F5 with the URL http://example/user/3, they access without restrictions.

I could save a list of visited routes in the store and validate using

router.beforeEach ((to, from, next) 

to verify that the route being accessed already exists in the list of visited routes, but I wanted to know if there is no functionality vue-router to solve it naturally.

about 4 years ago · Juan Pablo Isaza
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!