AJAX: Internet Explorer Has Native Support for Persistence?!?!

How the heck did I miss the existence of non-cookie persistence features in Internet Explorer since IE 5? This is from MSDN:

"Persistence enables authors to specify an object to persist on the client during the current and later sessions using Dynamic HTML (DHTML) behaviors. Persistence allows Microsoft Internet Explorer 5 and later to retain Web page information, styles, variables, and state. For example, a collapsible list of links within a table of contents can remain expanded to the user's choice upon leaving and later returning to the page. Or, a search engine query form can retain the last-used search string.

Persistence is implemented as a behavior. The new persistence behaviors include:

  • saveFavorite - persists page state and information when the web page is saved as a favorite.
  • saveHistory - persists page state and information within the current session's memory.
  • saveSnapshot - persists page state and information directly in the page when users save the Web page to their hard disk.
  • userData - persists page state and information within an Extensible Markup Language (XML) store, a hierarchical data structure."
Man, I'll have to mess around with this to see if it actually works and what the parameters are. I also need to look over all of the default behaviors that are available.

Check out this page, for example, which shows a demo for Internet Explorer that loads and saves permanent data into some kind of XML data store for web pages. This is crazy, and much better for storing permanent state, for Internet Explorer at least, then techniques I discovered this week.


splintor said…
This comment has been removed by a blog administrator.
splintor said…
Do note, however, that according to http://msdn.microsoft.com/workshop/author/behaviors/reference/behaviors/userdata.asp (in the Remarks section) there are still size limitations.
I checked it in a local file, and after exceeding 64 KB (65506 characters to be exact) I got a "Disk is full" exception when trying to save.

Note that this is strange, as the size limit for local machine should be 128 KB. maybe this size is in bytes, and JavaScript strings are stores as two-bytes unicode.

Anyway, this is far more than what cookies offer. Thanks for the idea. I'll offer it to a customer who is desparately waiting for a solutions.

Thanks a million.
Any chances of your integrating this too (transparently) into your AMASS framework -- as another storage method fallback, for clients that support the IE way, but not the Flash way?
Brad Neuberg said…
Splintor, I have done the same testing in IE and it does indeed have a 64 K limit.

Johan, I don't plan on incorporating this into the AMASS framework, since the Flash one is more universal.
Actually, JavaScript strings are exposed as UCS2, a 16bit encoding standard that predates UTF16.