js操作history


js操作history

  1. pushState

    pushState只會在當前history中添加一條記錄,並不會刷新瀏覽器
    history.pushState({}, "my title", "/test.html")
    
  2. replaceState

    replaceState會替換當前的history中的記錄,並且刷新瀏覽器
    history.replaceState({}, "my title", "/test.html")
    
  3. 跳轉

    history.go(1)   前進一個頁面
    history.go(-1)  后退一個頁面
    
  4. navigator

    獲取用戶瀏覽器相關信息
    console.log(navigator)
    


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM