Permalink
Browse files

fix back bug

  • Loading branch information...
1 parent b3b7e27 commit 0d52898772ebadda125ab77cc177d81459f7fa68 @jserme committed Mar 11, 2015
Showing with 9 additions and 3 deletions.
  1. +9 −3 _layouts/default.html
View
@@ -141,8 +141,8 @@
return this
}
- $(window).on('popstate', function(event) {
- var state = event.originalEvent.state
+ window.onpopstate = function(event) {
+ var state = event.state
if (!state) {
return
}
@@ -151,7 +151,13 @@
setContent(content, opts)
opts.callback && opts.callback()
}, opts.cache)
- })
+ }
+
+ //first init, replace current state
+ history.replaceState({
+ url: location.href,
+ title: document.title
+ }, document.title)
return this.on('click', opts.selector || 'a', function(event) {
if (!opts.container) {

0 comments on commit 0d52898

Please sign in to comment.