This also belongs in the url module, the gallery module also uses history.pushstate and interfaces with it through the url module.