The back button would do the same as it would do after you click a [next image] link :)
Not sure about your point, the history API improves UX if you do it right:
https://developer.mozilla.org/en-US/docs/Web/API/History_API
It does everything as hand written, pure HTML page would, just do it faster.