Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 History API: surviving to a a clear history?

The History API makes it possible to store a state object in the browser history. Now try this demo (but it's the same behavior with any other else, pick your favorite :)):

  1. Click on some links to build some history
  2. Clear your browser history (full, or just for this site)
  3. You are still able to walk through the history

I expected that clearing the history would have an impact, but it's not the case...
Can someone explain this behavior ?

like image 712
Jocelyn LECOMTE Avatar asked Mar 30 '12 17:03

Jocelyn LECOMTE


1 Answers

The history.pushState() method

"The state object can be anything that can be serialized. Because Firefox saves state objects to the user's disk so they can be restored after the user restarts her browser, we impose a size limit of 640k characters on the serialized representation of a state object. If you pass a state object whose serialized representation is larger than this to pushState(), the method will throw an exception. If you need more space than this, you're encouraged to use sessionStorage and/or localStorage."

Reference: https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history

like image 130
Rahen Rangan Avatar answered Oct 12 '22 05:10

Rahen Rangan