有什么方法可以使用 Javascript 进行 Ctrl-F5 刷新?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15633374/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 01:27:58  来源:igfitidea点击:

Is there any way to use Javascript to do a Ctrl-F5 refresh?

javascriptajax

提问by user2097335

I have a small asp file that runs inside of a frame. Is there any way that i can do a CTRL+F5type of refresh and reload the whole browser window. I've tried parent.location.reload(true), location.reload(), and quite a few others. The page doesnt seem to want to redirect. If i do a CTRL+F5on my keyboard it reloads fine. Any help is much appreciated

我有一个在框架内运行的小型 asp 文件。有什么方法可以让我进行CTRL+F5类型的刷新并重新加载整个浏览器窗口。我试过parent.location.reload(true), location.reload(), 和很多其他的。该页面似乎不想重定向。如果我在键盘上按CTRL+ F5,它会重新加载正常。任何帮助深表感谢

also i need to refresh/update my .js files in the browser through CTRL+F5

我还需要通过CTRL+在浏览器中刷新/更新我的 .js 文件F5

回答by Jitesh Tukadiya

Try following, FIrst of all in your <head>tag put following two lines

尝试遵循,首先在您的<head>标签中放置以下两行

<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="Expires" content="-1">

and then You can use location.reload(true)

然后你可以使用 location.reload(true)

回答by maximladus

There is a nice example placed here: http://grizzlyweb.com/webmaster/javascripts/refresh.asp

这里有一个很好的例子:http: //grizzlyweb.com/webmaster/javascripts/refresh.asp

Have fun!

玩得开心!