javascript - Is there a way to tell what direction the state is going with history.js? -


like title says, i'd able perform different onstatechange event if pushstate function called, instead of back function. or, if go function negative or positive.

example:

if history.pushstate() or history.go(1) called, want statechange event's callback forwardpushstate

if history.back() or history.go(-1) called, want statechange event's callback backwardspushstate

a state data related page (as user see in browser). if user wants in page, page same, either if coming button click or forward button click, think.

pushstate pushes new state in stack. has no relationship back , go. back , go functions navigate on pushed states in stack. because in edit, looks thinking pushstate , go(1) equivalent.

maybe if want know direction user coming, should analyse onstatechange event know if takes parameter stores direction. still don't know how do.

the main thing think, has no relationship go (-1) or go(1) or back.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -