[TOC]

一、简要回顾

  1. 首先,history是一个BOM对象,可以使用history.back()进行回退页面,或者是使用history.forward()进行前进。
  2. 这里主要使用的两个API,分别是history.pushState(data,title,url)和一个监听事件popstate,这个事件会在地址栏发生变化的时候发生。

    二、实例

    <body>
     <input type="text" id="search">
     <button onclick="search()">搜索</button>
     <div class="main"></div>
     <script>
         render(data);
     </script>
    </body>
    

    ```javascript