<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  <input type="button" >
  <script>
    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 强制刷新  从服务器获取页面
    }
  </script>
</body>
</html>

 

相关文章:

  • 2021-08-03
  • 2022-01-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-26
  • 2022-03-01
  • 2023-04-07
猜你喜欢
  • 2022-12-23
  • 2021-10-19
  • 2021-11-03
  • 2021-12-04
  • 2021-06-20
相关资源
相似解决方案