Navigating to local URL fragment doesn't modify browser history

I find this behavior extremely unexpected :slight_smile:

Here’s a sample page with no JavaScript. On Chromium, clicking that link takes you to the bottom of the page. Clicking back takes you back to where you clicked from. That’s expected behavior that you’ll see on every other website that doesn’t eat this history.

<a href="#target">link</a>

<div style="height:2000px"></div>

<div id="target">Hello</div>

I assume Discourse is handling URL fragments in JavaScript by scrolling to the location and therefore the history would have to be explicitly pushed.

@codinghorror expresses a strong and final opinion about this here. It’s surprising to see such a strong opinion about a change to standard web browser behavior. In fairness I haven’t yet used Discourse for heavy duty topic navigation and therefore can’t appreciate the obviousness of his argument.

I’m using Discourse in part for documentation and this behavior is extremely disruptive to the point that I’m afraid to click a link and lose my place on a page.

1 Like