Modifying a query string without reloading the page

前端 未结 5 2085
北荒
北荒 2020-11-29 17:18

I am creating a photo gallery, and would like to be able to change the query string and title when the photos are browsed.

The behavior I am looking for is often see

5条回答
  •  攒了一身酷
    2020-11-29 17:35

    Then the history API is exactly what you are looking for. If you wish to support legacy browsers as well, then look for a library that falls back on manipulating the URL's hash tag if the browser doesn't provide the history API.

提交回复
热议问题