From: Bjørn Erik Pedersen Date: Sat, 18 Nov 2017 09:54:07 +0000 (+0100) Subject: livereload: Fix recently broken window.location.reload logic X-Git-Tag: v0.31~9 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d99db71ab5a90246dce729ca802e4cd88b01ba3c;p=brevno-suite%2Fhugo livereload: Fix recently broken window.location.reload logic Closes #4100 --- diff --git a/livereload/livereload.go b/livereload/livereload.go index 90096577..7bfbbaf6 100644 --- a/livereload/livereload.go +++ b/livereload/livereload.go @@ -163,11 +163,13 @@ HugoReload.prototype.reload = function(path, options) { } path = path.substring(prefix.length); + + var portChanged = options.overrideURL && options.overrideURL != window.location.port - if (!options.overrideURL && window.location.pathname === path) { + if (!portChanged && window.location.pathname === path) { window.location.reload(); } else { - if (options.overrideURL) { + if (portChanged) { window.location = location.protocol + "//" + location.hostname + ":" + options.overrideURL + path; } else { window.location.pathname = path;