In Single Page Applications, it's common to update the URL when navigating, and re-render based on the new URL. This can happen when the user hits the back and forward button, clicks on an anchor tag, or does something that pushes a new state on the history object.
The consensus for detecting any kind of url change though is to poll every so many milliseconds.
It seems that this is because while users can add an EventListener to
hashchange, we still can't listen to
If an onpopstate event exists (which is used for navigating with the back and forward button), why doesn't an onpushstate event exist?
onpopstate has existed for so long, and there's no evidence of an
onpushstate in the works, I imagine that it was a conscious decision. Does that mean that adding it would enforce bad programming or patterns?