diff --git a/app/assets/javascripts/discourse/initializers/click-interceptor.js.es6 b/app/assets/javascripts/discourse/initializers/click-interceptor.js.es6 index d74e5264e32..763a06b2e87 100644 --- a/app/assets/javascripts/discourse/initializers/click-interceptor.js.es6 +++ b/app/assets/javascripts/discourse/initializers/click-interceptor.js.es6 @@ -1,8 +1,10 @@ import interceptClick from 'discourse/lib/intercept-click'; +import DiscourseURL from 'discourse/lib/url'; export default { name: "click-interceptor", initialize() { $('#main').on('click.discourse', 'a', interceptClick); + $(window).on('hashchange', () => DiscourseURL.routeTo(document.location.hash)); } }; diff --git a/app/assets/javascripts/discourse/lib/url.js.es6 b/app/assets/javascripts/discourse/lib/url.js.es6 index f94c4c2bd54..7f2d1bc6c44 100644 --- a/app/assets/javascripts/discourse/lib/url.js.es6 +++ b/app/assets/javascripts/discourse/lib/url.js.es6 @@ -105,7 +105,7 @@ const DiscourseURL = Ember.Object.createWithMixins({ It contains the logic necessary to route within a topic using replaceState to keep the history intact. **/ - routeTo: function(path, opts) { + routeTo(path, opts) { if (Em.isEmpty(path)) { return; } if (Discourse.get('requiresRefresh')) { @@ -122,6 +122,7 @@ const DiscourseURL = Ember.Object.createWithMixins({ // Scroll to the same page, different anchor if (path.indexOf('#') === 0) { this.scrollToId(path); + history.replaceState(undefined, undefined, path); return; }