[Openstreetmap-dev] Use of Cookies?

Nick Whitelegg Nick.Whitelegg at solent.ac.uk
Tue Aug 9 16:23:42 BST 2005


Might get the chance to talk about this tonight, but would just like to get
some feedback on a proposed use of cookies in my freemap site.

As I've mentioned before, I'm moving towards using AJAX (Asynchronous
JavaScript and XML) for a more functional user interface.
Part of the UI will involve the user selecting modes of use (e.g. route
select mode, distance calculation mode). These will be stored in javascript
variables. The user's current position will be stored in javascript
variables also.

What I would like to do (and even Google Maps doesn't seem to do this -
just tried it while searching for Curtain Road London...) is preserve user
state. In other words, if the user navigates away from the main map page
to, say, the instructions page, their "state" (i.e. the mode of use, and
latitude/longitude/OS grid ref position) should be preserved so that when
the user returns to the map page, they are presented with the same location
in the same mode.

Cookies are the obvious way to do this though I know that they are
sometimes regarded as somewhat non-PC due to their use in targeted
advertising, and so are sometimes turned off.

Session variables are the other way, though since they're stored
server-side that would require more coding effort - one would have to send
the user's state to the server when the user "unloads" the map page.

Seeing though as mode and position preservation is non *essential* (just
adds to the user experience) cookies are on balance acceptable I feel.
Feedback/comments?

Thanks,
Nick





More information about the dev mailing list