MENU
Accessing History
Before the page is reloaded, the state is null. It can be used to store data for the session. The size limit is 640k. If more space is needed, use sessionStorage or localStorage (10.2.2).
RESETRUNFULL
RESETRUNFULL
<!DOCTYPE html><html><head></head><body>
<script>
function p(s){
document.write(s+"<br/>");
}
p("length: "+history.length);
p("scrollRestoration: "+history.scrollRestoration);
p("state: "+JSON.stringify(history.state)); //history.go(-2); //history.back(); // .go(-1) //history.forward(); // .go(1)
const state = { 'page_id': 1, 'user_id': 5 }
const title = 'Gooood!' // currently ignored
const url = 'history.html' // must be current URL
history.pushState(state, title, url)
</script></body></html>