I’m working my way into HTMX and am currently following up on some weird history behaviour I see on my page. The page in question is a standard HTML page that loads in a couple divs using both hx-get and hx-post. It runs within a Django application.
What happens is that when that page is accessed via clicking a link using Firefox it creates two entries in the tab’s history, both pointing to the page’s URL. Because of this pressing the back button once only reloads the site, pressing it a second time takes the user back to where they came from.
Accessing the same page putting the URL directly into the address bar or clicking a link, but using Chromium, there’s only one history entry and the back button works as expected.
From the documentation the most promising fix I could find was setting hx-history to false, but that didn’t change the site’s behaviour and I couldn’t find any other settings that might influence this.
I’d be grateful for any pointers on why this happens and how to prevent it.
1