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