html和JavaScript,用戶點擊瀏覽器后退按鈕,或者返回上一步自動刷新方式


瀏覽器用戶返回上一步,自動刷新
方式一、
<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 >
方式二、
header("Cache-Control: no-store, must-revalidate, max-age=0");
header("Pragma: no-cache");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
方式三、
window.onpageshow = function(event) {
if (event.0) {
    window.location.reload() 
}
};

 轉載注明出處:https://www.cnblogs.com/cblogs/p/6126387.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM