The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Dynamic DOM and Page Refresh

I've been experimenting with writing a little "AJAX" application and have been manipulating the HTML DOM dynamically. Is there a way to make these modifications survive a page refresh?
John Topley Send private email
Tuesday, April 19, 2005
 
 
Come up with some encoding of your DOM state (e.g.: "(window (name 'jimmy') (left 45) ..."), a procedure to map the present state to an encoding, and another procedure to map an encoding to the present state.  Then just store the encoding of the present state in a cookie whenever there's some high-level transformation.
Kalani Send private email
Tuesday, April 19, 2005
 
 
Cookie?
Justin Send private email
Tuesday, April 19, 2005
 
 
Justin hit the nail on the head.

Cookies are a fantastic way to save display state across page refreshes.

Keep in mind the basic cookie limitations for size and domains ( < 4k per cookie and no more than 20 per domain, IIRC), and you can devise a sweet system for saving user display preferences and / or display state.
Geoff Moller Send private email
Tuesday, April 19, 2005
 
 
"Is there a way to make these modifications survive a page refresh?"

I think, like with most web operations, you should keep the server up to date with changes on the page.  Then when the page is refreshed, generate the page as it should be.
Almost Anonymous Send private email
Tuesday, April 19, 2005
 
 
Thanks for the responses, everyone. Almost Anonymous's suggestion is particularly intriguing.
John Topley Send private email
Tuesday, April 19, 2005
 
 
save to a hidden field
IDontKnow
Tuesday, April 26, 2005
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz