刷新

var btn = document.getElementById('btn');
btn.onclick = function () {
// console.log(location.href);

// location.href = 'http://www.itheima.com';

// assign 委派
// assign() 的作用和href的作用一样。可以让页面跳转到指定的地方
// location.assign('http://www.itheima.com');
//
// 替换掉地址栏中的地址,但是不记录历史
// location.replace('http://www.itheima.com');
// 重新加载 refresh f5
//
// 参数 true 强制从服务器获取页面 false 如果浏览器有缓存的话,直接从缓存获取页面
location.reload(true);

// f5 刷新页面,可能从缓存中加载 control+f5 强制刷新 从服务器获取页面
}

posted @ 2020-04-07 17:26  花木兰r  阅读(143)  评论(0编辑  收藏  举报