简体   繁体   中英

How does google maps change its URL without reloading and without using the history API?

So if you do anything on google maps (maps.google.com) such as search or click a place etc the URL changes and the page is clearly not reloading (can tell from the inspect element/console). I thought they might be using the HTML5 history API but that doesn't seem to be the case (window.history.currentState always returns undefined regardless of how many times the URL has changed).

So how does google do this?

Related questions from past (like 2010) also mentioned the hashtag method which they clearly don't use anymore (no hashtags anywhere in any of the URLs)

So I was wrong,they actually do seem to use the history API. Not sure why currentState always returned undefined but if I call window.history.state you can see the index changing and if you call back() it does what you'd expect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM