9

I am using History.js plugin which support HTML 5 pushState and replaceState. The statechange is triggered when a user click back/forward button and when pushState/replaceState is used. I need to check whether statechange event is triggered from back/forward button or by using pushState/replaceState methods.

Imran Qadir Baksh - Baloch
  • 32,612
  • 68
  • 179
  • 322

2 Answers2

1

I haven't looked at History.js, but Ben Alman's jQuery BBQ (Back-Button & Queue Library) is an excellent library that contains a 'hashchange' event. This might be different than what you are trying to do, though, since his library relies on hashtags in a URL, and not a browser's internal statechange. He's also got a repo on GitHub for hashchange.

ariestav
  • 2,799
  • 4
  • 28
  • 56
1

According to a discussion on the GitHub by the author, it is impossible to do that (from a year ago, can't find the link again). Your option really is to look for some kind of a workaround like breadcrumbs etc.

eric.itzhak
  • 15,752
  • 26
  • 89
  • 142
  • Did you ever find that link? I think it was possible even in 2011. See for example the code I gave in answer to [another question](https://stackoverflow.com/questions/8980255). – Michael Allan Mar 17 '18 at 16:59