Fallback for browsers that don't support window.history.pushstate

This commit is contained in:
Mike DeRosa 2014-07-06 18:22:24 -04:00
parent 4ccd7131d3
commit 070ba40f4f
1 changed files with 15 additions and 8 deletions

View File

@ -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)
{