extract inline onpopstate handler on 404 page (#6613)

This commit is contained in:
Kyle Zhao 2018-11-15 13:35:38 -05:00 committed by GitHub
parent f0760908e3
commit 5f754b43f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 7 deletions

View File

@ -0,0 +1,6 @@
window.onpopstate = function(event) {
// check if Discourse object exists if not take care of back navigation
if (event.state && !window.hasOwnProperty("Discourse")) {
window.location = document.location;
}
};

View File

@ -38,11 +38,5 @@
</div>
</div>
<script language="Javascript">
window.onpopstate = function(event) {
if (event.state && !window.hasOwnProperty("Discourse")) { //check if Discourse object exists if not take care of back navigation
window.location = document.location;
}
};
</script>
<%= preload_script('onpopstate-handler') %>
<%- end %>

View File

@ -128,6 +128,7 @@ module Discourse
activate-account.js
auto-redirect.js
wizard-start.js
onpopstate-handler.js
}
# Precompile all available locales