Routing
History
Push State / Replace State
The url will change, but the html doesn't be changed
pushState(state, unused, url)
state: put the object data to this page
unused: always give empty string is okay
url: for changing url to the browser without going to new page
replace vs push: create new url to the history or not
Location
Information
host: the hostname + port number
hostname
pathname: /xxx...
search: ?...., used to assign additional data to the page and can be displayed to the user
hash: #..., represent the fragment section of the page and change the hash without full page loading
href : the full url
Method
Last updated
Was this helpful?