From 070ba40f4f7c64f1ed14df13749f94b59b9ce961 Mon Sep 17 00:00:00 2001 From: Mike DeRosa Date: Sun, 6 Jul 2014 18:22:24 -0400 Subject: [PATCH] Fallback for browsers that don't support window.history.pushstate --- src/static/js/pad.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/static/js/pad.js b/src/static/js/pad.js index 994d78450..7d487b1cb 100644 --- a/src/static/js/pad.js +++ b/src/static/js/pad.js @@ -449,14 +449,21 @@ var pad = { switchToPad: function(padId) { var options = document.location.href.split('?')[1]; - if(options != null) - window.history.pushState("", "", "/p/" + padId + '?' + options); - else - window.history.pushState("", "", "/p/" + padId); - - sendClearSessionInfo(); - receivedClientVars = false; - sendClientReady(false); + var newHref = "/p/" + padId; + if (options != null) + newHref = newHref + '?' + options; + + if(window.history && window.history.pushState) + { + window.history.pushState("", "", newHref); + sendClearSessionInfo(); + receivedClientVars = false; + sendClientReady(false); + } + else // fallback + { + window.location.href = newHref; + } }, sendClientMessage: function(msg) {