livereload: Fix recently broken window.location.reload logic

Closes #4100
This commit is contained in:
Bjørn Erik Pedersen 2017-11-18 10:54:07 +01:00
parent 503ca6de6c
commit d99db71ab5
No known key found for this signature in database
GPG Key ID: 330E6E2BD4859D8F

View File

@ -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;