history.nette.ajax.js icon indicating copy to clipboard operation
history.nette.ajax.js copied to clipboard

Fixing condition in popstate event handler

Open zipper opened this issue 8 years ago • 1 comments

After merging #33, the popstate history stopped working at all. I believe the reason is that e.event is always undefined on this line. e is jQuery Event Object, which does not contain property event. The proposed and linked solution on stack overflow however uses native JS event. Therefore, the correct condition should be using e.originalEvent.state:

...
if (initialPop || !e.originalEvent.state) {
...

zipper avatar Jan 24 '17 13:01 zipper

:+1: Just bumped into same issue and this fix works.

zaxxx avatar Feb 13 '17 05:02 zaxxx