I am creating a photo gallery and want to be able to change the query string and title when viewing photos.
The behavior I'm looking for is often found with some implementations of a continuous / infinite page, where when you scroll down, the query string continues to increment the page number ( http://x.com?page=4 ), etc. This should be simple in theory, but I would like something safe in major browsers.
I found this great post and tried to follow the example with window.history.pushstate , but this does not seem to work for me. And I'm not sure if this is perfect, because I donβt care about changing the browser history.
I just want to offer the ability to bookmark the currently viewed photo without reloading the page every time the photo changes.
The following is an example of an endless page that modifies the query string: http://tumbledry.org/
UPDATE found this method:
window.location.href = window.location.href + '#abc';
It works for me, but I'm on a new chrome. This could probably cause some problems with older browsers?
javascript jquery query-string dhtml
Sonic Soul Jun 10 2018-12-12T00: 00Z
source share