Reputation: 4237
From https://developer.mozilla.org/en/DOM/window.onpopstate :
A popstate event is dispatched to the window every time the active history entry changes. If the history entry being activated was created by a call to history.pushState() or was affected by a call to history.replaceState(), the popstate event's state property contains a copy of the history entry's state object.
What does active history mean here?
I have a url like: domain/?pn=1
When i click on next page button, the url becomes: domain/?pn=2 (History changes but popState not called)
When I click on some other button, the url becomes: domain/?pn=2#speacial (History changes with hash and popState is called)
Can anyone explain this difference?
Upvotes: 0
Views: 514
Reputation: 943981
What does active history mean here?
Not a lot. active is a modifier to history entry not to history.
You have a history. There are URLs in it. They are the URLs that you have visited. The active one is the one you are currently looking at.
Can anyone explain this difference?
The actual text for the URL you reference is:
A popstate event is dispatched to the window every time the active history entry changes between two history entries for the same document.
/?pn=1
and /?pn=2
are different documents (assuming you aren't using pushState
).
Changing the fragment id just points to different places within the same document #speacial
.
Upvotes: 1