diff --git a/app/assets/javascripts/discourse/lib/url.js.es6 b/app/assets/javascripts/discourse/lib/url.js.es6 index 93e1ca73151..8fbd12d7d95 100644 --- a/app/assets/javascripts/discourse/lib/url.js.es6 +++ b/app/assets/javascripts/discourse/lib/url.js.es6 @@ -90,6 +90,15 @@ const DiscourseURL = Ember.Object.extend({ }); }, + routeToTag(a) { + if (a && a.host !== document.location.host) { + document.location = a.href; + return false; + } + + return this.routeTo(a.href); + }, + /** Our custom routeTo method is used to intelligently overwrite default routing behavior. diff --git a/app/assets/javascripts/discourse/widgets/home-logo.js.es6 b/app/assets/javascripts/discourse/widgets/home-logo.js.es6 index dc52db7cba5..4684901aee7 100644 --- a/app/assets/javascripts/discourse/widgets/home-logo.js.es6 +++ b/app/assets/javascripts/discourse/widgets/home-logo.js.es6 @@ -48,15 +48,9 @@ export default createWidget('home-logo', { click(e) { if (wantsNewWindow(e)) { return false; } - e.preventDefault(); - const a = $(e.target).closest('a')[0]; - if (a && a.host !== document.location.host) { - document.location = a.href; - } - DiscourseURL.routeTo(this.href()); + DiscourseURL.routeToTag($(e.target).closest('a')[0]); return false; } - }); diff --git a/app/assets/javascripts/discourse/widgets/link.js.es6 b/app/assets/javascripts/discourse/widgets/link.js.es6 index 5f1782fd056..1ccc5353687 100644 --- a/app/assets/javascripts/discourse/widgets/link.js.es6 +++ b/app/assets/javascripts/discourse/widgets/link.js.es6 @@ -81,6 +81,6 @@ export default createWidget('link', { this.sendWidgetEvent('linkClicked'); } - return DiscourseURL.routeTo(this.href(this.attrs)); + return DiscourseURL.routeToTag($(e.target).closest('a')[0]); } });