I have one image website where users can vote images. IMAGES ARE RANDOMLY GENERATED ON FIRST PAGE! Once they vote they’re redirected using window.location to the image details page. If they click back they will see the same image…from the browser cache..and they can vote it unlimited times….
How to I remove the cache? I want the first page to refresh when I click back button! I already used :
<meta http-equiv="Pragma" content="no-cache">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="Expires" CONTENT="-1">
and
<input type="hidden" id="refreshed" value="no">
<script type="text/javascript">
onload=function(){
var e=document.getElementById("refreshed");
if(e.value=="no")e.value="yes";
else{e.value="no";location.reload();}
}
</script>
thanks !!!!!
You don’t want to use client-side checking to prevent users voting multiple times. That’s just silly.
You want to check on the server whether a user has already voted for that image, and if so, direct them to some “Oops you’ve already voted for that” page and don’t count the vote.