Safari forgets your history

from blog The Desolation of Blog, | ↗ original
Clicking a link in a web browser changes the URL, and if you look at the browser's history after clicking, you'll see both the old URL and the new URL. The URL can also be changed programmatically, using the JavaScript Location API. After a new location is assigned in JavaScript, you should also see the old URL and the new URL in the browser's history. You should, and you do in Chrome and Firefox. But not in Safari! For some reason, Safari forgets the URLs. This bug appears to be many years old: it occurs in the latest version 15.1, and it occurs in the oldest version that I could test, Safari 11 on macOS 10.13 High Sierra. You can reproduce the bug by simply clicking the button below. The button runs a little script to change the location from my blog to my business web site.