Assigning to document.location.href without clobbering history

I was facing the same problem and found this workaround which worked for me

instead of

function onAjaxCallback(evt){
    location.href=newLocation;
}

i wrapped the location.href call around a setTimeout. Seems to do the trick. My history’s behaving fine now. Hope that helps

function onAjaxCallback(evt){
    setTimeout(function(){
        location.href=newLocation;
    },0)
}

Leave a Comment