history.replaceState() example?

后端 未结 8 932
礼貌的吻别
礼貌的吻别 2020-11-29 20:14

Can any one give a working example for history.replaceState? This is what w3.org says:

history . replaceState(data, title [, url ] )

8条回答
  •  南方客
    南方客 (楼主)
    2020-11-29 20:28

    The second argument Title does not mean Title of the page - It is more of a definition/information for the state of that page

    But we can still change the title using onpopstate event, and passing the title name not from the second argument, but as an attribute from the first parameter passed as object

    Reference: http://spoiledmilk.com/blog/html5-changing-the-browser-url-without-refreshing-page/

提交回复
热议问题