Using JavaScript to change the URL used when a page is bookmarked

后端 未结 6 559
误落风尘
误落风尘 2021-01-14 05:55

JavaScript doesn\'t allow you to update window.location without triggering a reload. While I agree with this policy in principle (it shouldn\'t be possible to

6条回答
  •  悲哀的现实
    2021-01-14 06:19

    Sounds like you should check out Really Simple History. It's how Google (for example, Gmail) allows any page to be bookmarkable (and has history) but doesn't refresh the whole page.

    As for the other side of things (having people visit your site then automatically popping up the correct image), I'd try checking window.location.hash once the page loads and firing events based on that.

提交回复
热议问题