diff --git a/app/views/exceptions/not_found.html.erb b/app/views/exceptions/not_found.html.erb
index ca44c1d80..4a4a7db01 100644
--- a/app/views/exceptions/not_found.html.erb
+++ b/app/views/exceptions/not_found.html.erb
@@ -43,7 +43,7 @@
}
window.onpopstate = function(event) {
- if (!window.hasOwnProperty("Discourse")) { //check if Discourse object exists if not take care of back navigation
+ if (event.state && !window.hasOwnProperty("Discourse")) { //check if Discourse object exists if not take care of back navigation
window.location = document.location;
}
};