Fixes #2833
This makes it easy to mock browser location and paves the way to implementing hash routing.