I am making a web app and when a user logs out and is taken to the login page, I want to stop them from being able to go back to the previous page (the logged in page) as they just logged out and this would be a security issue? I was wondering who I could do this in JavaScript? I would like it ideally to just reload the current page they are on the first time they hit it and then if they hit it a second time go to the last page where they weren't logged in. Or if thats not possible then to do what the standard practice is?
Here is what I am trying but its not working,
<script type="text/javascript">
onload=function(){
console.log('called')
e=document.getElementById("refreshed");
if(e.value=="no")e.value="yes";
else{e.value="no";location.reload();}
}
</script>
I get an error saying e is not defined