0
Hey there, guys. Next, I made a code for uploading content in Ajax and used history.pushState to change the browser URL, but when I click Back, it doesn’t load the previous address, it just changes the link in the address bar.
How do I click the Back button, besides changing the URL, press it?
Thank you for your attention!
JS Code:
function AbreEmDIV(endereco){
var linkMain = endereco.replace("ajax", "main")
var divConteudo = "#conteudo"
var linkAtual = window.location.href
var obj = { Title: '', Url: linkMain };
$.ajax({url: endereco, success: function(result){
$(divConteudo).html(result);
window.history.pushState(obj, obj.Title, obj.Url);
}});
}
Doesn’t work?
window.location = linkAtual;
orwindow.history.back(0);
– Ivan Ferrer