如何使用JavaScript刷新页面?


当前回答

你们可能需要使用

    location.reload(forceGet)

forceGet是一个布尔值,也是可选的。

默认值为false,这将重新加载缓存的页面。

其他回答

你可以用两种方式写。第一种是重新加载页面的标准方式,也称为简单刷新

location.reload(); //simple refresh

另一种叫做硬刷新。在这里传递布尔表达式并将其设置为true。这将重新加载页面,销毁旧缓存并从头开始显示内容。

location.reload(true);//hard refresh

问题应该是,

如何使用JavaScript刷新页面

window.location.href = window.location.href; //This is a possibility
window.location.reload(); //Another possiblity
history.go(0); //And another

你被宠坏了。

我想有很多方法会奏效:

window.location.reload();history.go(0);window.location.href=window.location.html;

use

location.reload();

or

window.location.reload();

jQueryLoad函数还可以执行页面刷新:

$('body').load('views/file.html', function () {
    $(this).fadeIn(5000);
});