This is one of those, "I need a workaround so as not to have to endure 1000 years of bickering from users, once the project launches" type questions:
I have a situation where I need to have my site reload any time someone launches Chrome without closing the tab last time they closed the browser. We are rebuilding an ancient site in a modern, MEAN stack environment, and I just know I will get complaints on this when it launches.
In other words (danger: psuedocode) -
if client closed chrome with site open
reauthenticate user
redirect to home page
I can accomplish the last two bits through an express route and passport auth, but how do I detect if the client is loading a cached page from their end?
Is it possible to simply store some sort of js variable that is only set true after an actual login, or does Chrome keep that stored on close as well?
A simple example to go along with my comment:
<html>
<head>
<script>
function DoMagic() {
document.getElementById( "magic" ).innerHTML = "<h1>Hello World!</h1>";
}
</script>
</head>
<body>
<div id="magic">Waiting for magic</div>
<br>
<input type="button" value="Do Magic" onclick="DoMagic();" />
</body>
</html>
The state isn't kept between browser closes--even if the cache is. I'm thinking you can implement something similar to make sure they have to login between browser closes. Should work in all browsers too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With