HTMX - window.location.href returns previous URL link
HTMX emits the htmx:pushedIntoHistory
event after it pushed the new URL to the history. You can attach an event listener to it by:
htmx.on("htmx:pushedIntoHistory", function(event) {
console.log(window.location.href)
})