From db56b3ca213a9611d99e4a4790d8cd73daf8ca18 Mon Sep 17 00:00:00 2001 From: Danny Herran Date: Mon, 9 Jun 2014 17:08:52 +0100 Subject: [PATCH] Added internal flag to detect back/forward use var state = History.getState(); if (state.internal) { } --- scripts/bundled-uncompressed/html5/jquery.history.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/bundled-uncompressed/html5/jquery.history.js b/scripts/bundled-uncompressed/html5/jquery.history.js index 48a7f5ca..dec651ae 100644 --- a/scripts/bundled-uncompressed/html5/jquery.history.js +++ b/scripts/bundled-uncompressed/html5/jquery.history.js @@ -1763,7 +1763,7 @@ */ History.onPopState = function(event,extra){ // Prepare - var stateId = false, newState = false, currentHash, currentState; + var stateId = false, newState = false, currentHash, currentState, isInternal = false; // Reset the double check History.doubleCheckComplete(); @@ -1798,6 +1798,7 @@ if ( stateId ) { // Vanilla: Back/forward button was used newState = History.getStateById(stateId); + isInternal = true; } else if ( History.expectedStateId ) { // Vanilla: A new state was pushed, and popstate was called manually @@ -1825,6 +1826,9 @@ return false; } + // Store the internal status + newState.internal = isInternal; + // Store the State History.storeState(newState); History.saveState(newState);