Skip to content

Commit 84771cb

Browse files
authored
Merge pull request #334 from canjs/332-fix-hard-load
Fixed hard reload. Fixes #332
2 parents ab4e3a5 + c4e75c4 commit 84771cb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

static/canjs.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ var $articleContainer,
4040
if (noModifierKeys && sameHostname && sameProtocol) {
4141
ev.preventDefault();
4242
var href = this.href;
43-
window.history.pushState(null, null, href);
4443
navigate(href);
4544
}
4645
});
@@ -92,7 +91,6 @@ function init() {
9291
if (!searchControl) {
9392
searchControl = new SearchControl(".search-bar", {
9493
navigate: function(href){
95-
window.history.pushState(null, null, href);
9694
navigate(href);
9795
},
9896
pathPrefix: window.pathPrefix,
@@ -242,8 +240,11 @@ function navigate(href) {
242240
if(searchControl.searchResultsCache){
243241
searchControl.renderSearchResults(searchControl.searchResultsCache);
244242
}
243+
244+
window.history.pushState(null, null, href);
245245
},
246246
error: function() {
247+
window.history.pushState(null, null, href);
247248
// just reload the page if this fails
248249
window.location.reload();
249250
},

0 commit comments

Comments
 (0)