Html 单击链接时刷新页面
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20783015/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Refresh page when clicked on link
提问by Benny
I have the following to refresh my page when clicked on href.
单击href时,我有以下内容可以刷新我的页面。
<a href="javascript:history.go(0)">Click to refresh the page</a>
I have this
我有这个
<meta http-equiv="no-cache">
in the head tag. Even then I am getting a cached copy. How can I avoid loading cached copy?
在头部标签中。即使那样,我也会得到一个缓存副本。如何避免加载缓存副本?
回答by Green Wizard
instead of
代替
javascript:history.go(0);
you may use
你可以使用
javascript:window.location.reload();
回答by NiksD
<a onclick="window.location.href=this">test</a>
回答by scrblnrd3
In your <meta>
tag, you're missing a content attribute. try this
在您的<meta>
标签中,您缺少内容属性。尝试这个
<meta http-equiv="expires" content="0" />
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="expires" content="-1" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
You could also try
你也可以试试
<a href="javascript:window.location.reload();">
but I'm not sure how that would work with regards to caching
但我不确定在缓存方面如何工作
回答by Istiaque Ahmed
回答by Rakesh Kumar
Try this
尝试这个
window.location.href=window.location.href