1

Basically, there is this open question about how to prevent a user from accessing their home page, after having hit the back arrow using node js/express-sessions...

The best way to prevent this was discussed in this post:

https://stackoverflow.com/a/6505456/6341935

I found that this solution works effectively on laptop/computer (not mobile) browsers:

res.header('Cache-Control', 'no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0');

I was wondering if anyone else had a backend solution to this problem that also works on mobile.

Thanks guys... Otherwise I would resort to a hacky ejs/javascript solution that isn't nearly as simple/effective.

TylerHough
  • 25
  • 1
  • 11
  • What is the actual problem you're trying to solve? What problem occurs when the user uses the back button? Usually, stopping the user from doing what they want to do is not the most effective design. So, if using the back button causes some problem, better to address that problem that prevent the user from going where the user wants to go. They can already bookmark the home page and got their via a bookmark so there should be no conceptual problem with letting them go there other ways. – jfriend00 Dec 02 '19 at 01:51
  • Right now, the is an [XY Problem](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem) where you've described a problem with your attempted solution rather than described the actual problem. Difficult for us to provide the best advice that way. – jfriend00 Dec 02 '19 at 01:53
  • @jfriend00 The problem is that when you are trying to prevent a user from accessing a page that they shouldn't have access to, this solution doesn't work on mobile... I found a solution for it, but I don't care enough to put it out here for everyone because its far too creative. – TylerHough Dec 10 '19 at 02:12

0 Answers0