summaryrefslogtreecommitdiffhomepage
path: root/livereload
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2017-11-18 10:54:07 +0100
committerBjørn Erik Pedersen <[email protected]>2017-11-18 10:54:07 +0100
commitd99db71ab5a90246dce729ca802e4cd88b01ba3c (patch)
tree0e7b0120206fdf8f6aebb00d9f426a8f40ed61c7 /livereload
parent503ca6de6ceb0b4af533f9efeff917d6f3871278 (diff)
downloadhugo-d99db71ab5a90246dce729ca802e4cd88b01ba3c.tar.gz
hugo-d99db71ab5a90246dce729ca802e4cd88b01ba3c.zip
livereload: Fix recently broken window.location.reload logic
Closes #4100
Diffstat (limited to 'livereload')
-rw-r--r--livereload/livereload.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/livereload/livereload.go b/livereload/livereload.go
index 90096577d..7bfbbaf6b 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;