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

后端 未结 6 612
误落风尘
误落风尘 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:11

    You can add an anchor to the URL without reloading the page and pick that up with javascript:

    location.href = '.../#' + imageId;
    

提交回复
热议问题