I want to prevent users from visiting previously visited pages after logout without clearing cache in rails.
Asked
Active
Viewed 22 times
-2
-
possible duplicate of [Prevent the back action after logout](http://stackoverflow.com/questions/4263767/prevent-the-back-action-after-logout) – Brad Werth Aug 25 '15 at 21:09
-
http://stackoverflow.com/a/4265575/525478 – Brad Werth Aug 25 '15 at 21:09
1 Answers
-1
Are you using any gems like devise
? Simple to use and easy to set up. All is in the doc. We can't help you out without any further information like the gems you're using, what did you tried, ect. But in any case devise
have what you're looking for.
Erasing caches still needs the approbation of the user by the way, but you can do it with Jquery : look here : https://api.jquery.com/removeData/

Nathan Schwarz
- 631
- 5
- 19
-
I have not used any gems. I just checked with session and it works fine but the problem is that after logout when user hits back button it displays the previous pages. Clearing the cache will affect performance so I am looking for any better solution. Thanks! – Ajay Shinde Aug 25 '15 at 21:17
-
And in any case erasing cache needs the approbation of the user – Nathan Schwarz Aug 25 '15 at 21:20
-
-
I think clearing cache will not be the great as every time browser will load assets I will try using devise and will let you know – Ajay Shinde Aug 25 '15 at 21:21
-
Using jquery? Can you please explain it.I means how we can achieve this using jquery – Ajay Shinde Aug 25 '15 at 21:23
-
It's simple : you parse a wrapper containing all the content you want into a `.data()` in your script, then you call a `.removeData()` when the user click on the log-out button. Look here for more details: https://api.jquery.com/removeData/ – Nathan Schwarz Aug 25 '15 at 21:30
-
But it's a bad solution to destroy the caches. The better way is to forbid an non connected user to see the content – Nathan Schwarz Aug 25 '15 at 21:32