Skip to content

Commit 8d84de6

Browse files
author
Alexandre Stanislawski
committed
fix(url-sync): handle both hash and query parameter fix #165
1 parent c9eeba6 commit 8d84de6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

widgets/url-sync.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ var hashUrlUtils = {
3333
window.addEventListener('hashchange', cb);
3434
},
3535
pushState: function(qs) {
36-
window.location.assign(this.character + qs);
36+
window.location.assign(document.location.search + this.character + qs);
3737
},
3838
replaceState: function(qs) {
39-
window.location.replace(this.character + qs);
39+
window.location.replace(document.location.search + this.character + qs);
4040
},
4141
readUrl: function() {
4242
return window.location.hash.slice(1);
@@ -53,10 +53,10 @@ var modernUrlUtils = {
5353
window.addEventListener('popstate', cb);
5454
},
5555
pushState: function(qs) {
56-
window.history.pushState(null, '', this.character + qs);
56+
window.history.pushState(null, '', this.character + qs + document.location.hash);
5757
},
5858
replaceState: function(qs) {
59-
window.history.replaceState(null, '', this.character + qs);
59+
window.history.replaceState(null, '', this.character + qs + document.location.hash);
6060
},
6161
readUrl: function() {
6262
return window.location.search.slice(1);

0 commit comments

Comments
 (0)