wistia / fresh-url

Drop this script on your page and enjoy the freshest of URLs
270 stars 30 forks source link

When calling replaceState to update url, keep state object intact #18

Closed mrdavidjcole closed 5 years ago

mrdavidjcole commented 5 years ago

If Fresh URL is used on a page where some other script expects to be able to manage history.state, said script will not be in for a good time. As is, Fresh URL overwrites history.state to be {} when updating the URL to the freshened version. Minimal repro: https://fresh-url-replacestate-testing.glitch.me/

This PR makes it keep history.state intact.

My understanding is that Fresh URL's intention is to only change the visible URL, and not the underlying state object, so this change shouldn't impact Fresh URL's desired functionality.

bschwartz commented 5 years ago

Wise change! Looks good to me!