我想要一个自动硬刷新,而不是简单的自动刷新在我的网页上 [英] I want an auto hard refresh, not a simple auto refresh on my webpages

查看:128
本文介绍了我想要一个自动硬刷新,而不是简单的自动刷新在我的网页上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以通过插入元标记(如


,在我的某些网页(例如我网站的主页)上进行简单的自动刷新

 < 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).

这篇关于我想要一个自动硬刷新,而不是简单的自动刷新在我的网页上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆