问题描述
我知道我可以通过插入元标记(如
),在我的某些网页(例如我网站的主页)上进行简单的自动刷新
< meta http-equiv =refreshcontent =600>
但是做完这些后,我得到了很长的页面持续时间和会话持续时间。这是不现实的,我认为刷新不会重置页面持续时间计数器,我认为这应该发生。
我想这可以用一个硬刷新(Windows中的Ctrl-F5,MacOSX中的Option + R),但我不知道是否可以强制刷新为硬刷新 ...或者如果这种刷新将符合我的目的。
我正在寻找答案,显然它们都在头文件中。
你需要发送一个no-cache头,在php中这将是:
$ b $ pre $ header( Cache-Control:no-cache,must-revalidate); // HTTP / 1.1
header(Expires:Sat,26 Jul 1997 05:00:00 GMT); //过去的日期
..然后只需正常刷新(javascript或meta)。
I know I can do a simple auto-refresh on some of my webpages (for example, the Home page of my site) by inserting a meta tag like
<meta http-equiv="refresh" content="600">
But after doing this I'm getting really long page duration and session duration. This is not realistic, and I think that the refresh does not "reset" the page duration counter, which I think should happen.
I guess this could be done with a hard refresh (Ctrl-F5 in Windows, Option+R in MacOSX), but I don't know if it is possible to force the refresh to be a hard refresh... or if this kind of refresh would serve to my purpose.
I was searching for an answer to this, and it's all in the headers apparently.
You need to send a no-cache header, in php this would be:
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
..and then just refresh as normal (javascript or meta).
这篇关于我想要一个自动硬刷新,而不是简单的自动刷新在我的网页上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!