Reputation: 23
example http://maps.lt when you zoom in some city, u click refresh and then page automaticaly starts from begining, The point is that we want after refresh, keep same position zoomed in. thank you.
Give a man a fish, and you feed him for a day; show him how to catch fish, and you feed him for a lifetime.
Upvotes: 2
Views: 234
Reputation: 375
Try using the localStorage API.
localStorage.set("key", "value");
You can use the set method every time the user moves, and then when they reload the page, you can do
localStorage.get("key");
, which will return the value for that key. This can also be expanded with JSON.stringify
and JSON.parse
for stringifying and parsing JSON, which can be stored and retrieved from localStorage
.
You can also use parseInt(localStorage.get("key"));
to retrieve a number.
Hope I helped!
Upvotes: 3