Skip to content

Node.js based forum software built for the modern web

closes #1642

psychobunnye47c375e6913
diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js
index 74c588a1ed..865626635c 100644
--- a/public/src/ajaxify.js
+++ b/public/src/ajaxify.js
@@ -10,13 +10,15 @@ $(document).ready(function() {
rootUrl = location.protocol + '//' + (location.hostname || location.host) + (location.port ? ':' + location.port : ''),
apiXHR = null;
- window.onpopstate = function (event) {
- if (event !== null && event.state && event.state.url !== undefined) {
- ajaxify.go(event.state.url, function() {
- $(window).trigger('action:popstate', {url: event.state.url});
+ $(window).on('popstate', function (ev) {
+ ev = ev.originalEvent;
+
+ if (ev !== null && ev.state && ev.state.url !== undefined) {
+ ajaxify.go(ev.state.url, function() {
+ $(window).trigger('action:popstate', {url: ev.state.url});
}, true);
}
- };
+ });
ajaxify.currentPage = null;
diff --git a/public/src/modules/composer.js b/public/src/modules/composer.js
index 568dae805c..461681ed58 100644
--- a/public/src/modules/composer.js
+++ b/public/src/modules/composer.js
@@ -22,7 +22,7 @@ define('composer', [
$(window).off('resize', onWindowResize).on('resize', onWindowResize);
- $(window).on('action:popstate', function(ev, data) {
+ $(window).on('popstate', function(ev, data) {
var env = utils.findBootstrapEnvironment();
if (composer.active && (env === 'xs' || env ==='sm')) {
@@ -95,6 +95,11 @@ define('composer', [
composer.posts[uuid] = post;
composer.load(uuid);
+
+ var env = utils.findBootstrapEnvironment();
+ if (env === 'xs' || env ==='sm') {
+ history.pushState({}, '', '#compose');
+ }
}
function composerAlert(message) {