使用浏览器回退时页面刷新处理
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>页面自动刷新测试</title> <script src="../lib/jquery.js"></script> </head> <body> <a href="http://www.baidu.com">跳转吧,使用浏览器回退到本页会刷新哦</a> <script> $(function(){ setInterval(function(){ var timestamp=$("body").data("page_timestamp"); if(typeof(timestamp)=='undefined'||timestamp==null){ $("body").data("page_timestamp",new Date().getTime()); }else{ var currDate=new Date().getTime(); if(currDate-timestamp>2000){ window.location.reload(); }else{ $("body").data("page_timestamp",currDate); } } },1000); }); </script> </body> </html>