[OpenLayers-Users] Browser back and forward button

Christopher Schmidt crschmidt at metacarta.com
Wed Jul 30 08:42:28 EDT 2008


On Tue, Jul 29, 2008 at 10:19:29PM -0700, Matthew Doyle wrote:
> 
> Hi OpenLayers Users,
> 
> My client has a need to place control on the users browser back and forward
> buttons. Simply put, when he does any sort of action like zoom, pan, switch
> a layer on, etc. he always assumes that the back button will take him to the
> last state he was in within the mapping tool.  As such, he has now requested
> that this become a feature.
> 
> a) is it possible to control this? The only way i can think of is each time
> a user initiates an action, that it is stored in the hashmap in the URL ...
> index.html?zoom=1&layers=xxx similar to a permalink that is updated after
> every action.

This particular implementation will force a page reload with every
action, so is likely not a good choice. 

There are several sets of resources on the web for solving this problem
in various ways: storing data in the post-hash section of the URL,
putting data in a hidden iframe and reloading, etc. You'd need to
research and pick one.


> b) is there any code that anybody has already written to do this?

Not that I'm aware of. It's a longstanding feature request with no work
done on it so far.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list