jashkenas/backbone — pull request #2668 by magnusvk (2013-07-11 19:22:39+00:00)
Title: avoid jumping to the top of the page when resetting the hash fragment

Right now, when the Backbone router resets the hash fragment to be empty, the page always jumps to the top. This is apparently intended design in these browsers. However, it's really annoying in our case where a back / forward navigation should leave the user in the same spot of the page and just change the content displayed there.

This solves that problem by setting the hash to _ instead of empty. As that's an anchor that doesn't exist on the page, the jump is avoided. When reading the hash, we just treat a hash of _ as empty.