Permalink
Browse files

Fixed a bug that prevented IE from executing the callback when the UR…

…L was changed by bookmarks. Close #5
  • Loading branch information...
1 parent 6a8b559 commit efea477989db8d035f19dc6684d05dec4806bd37 Takayuki Miwa committed Jul 24, 2010
Showing with 13 additions and 5 deletions.
  1. +13 −5 jquery.history.js
View
@@ -88,11 +88,19 @@
setInterval(_.check, 100);
},
check: function() {
- var current_hash = iframeWrapper.get();
- if(current_hash != _.appState) {
- locationWrapper.put(current_hash);
- _.appState = current_hash;
- _.callback(current_hash);
+ var iframe_hash = iframeWrapper.get(),
+ location_hash = locationWrapper.get();
+
+ if (location_hash != iframe_hash) {
+ if (location_hash == _.appState) { // user used Back or Forward button
+ _.appState = iframe_hash;
+ locationWrapper.put(iframe_hash);
+ _.callback(iframe_hash);
+ } else { // user loaded new bookmark
+ _.appState = location_hash;
+ iframeWrapper.put(location_hash);
+ _.callback(location_hash);
+ }
}
},
load: function(hash) {

0 comments on commit efea477

Please sign in to comment.