It's impossible to say whether that code will work if just copy and
pasted.

The setCookie() function needs to access the GMap2 map object using
the variable name 'map' - have you got a global variable named 'map'?

If you get SetCookie() to work then you need another function which
executes when the map has loaded.
This function needs to read the cookie string, parse it to lat, lng
and zoom and then set the map view.

You say your map is running on your localhost - if you want specific
help with code you will have to put your code online so someone can
help:

http://www.google.com/url?sa=D&q=http://groups.google.com/group/google-maps-api/web/why-including-a-link-is-critical&usg=AFQjCNFjMDq3e9kiQBzYrcSnHsRQisyZzA

Martin.

On 2 Sep, 04:00, Andrew Liu <andrewli...@ucla.edu> wrote:
> Thanks for helping
>
> I found this 
> websitehttp://www.wurmonline.com/wiki/index.php?title=Annotating_googlemaps#...
>
> Will this code work? I'm not sure what to change? I added this to the script
> from the website and changed onunload="GUnload()" to onunload="setCookie()"
>
> I'm not sure exactly what to change?
>
>     // function to write out the cookie on exit
>     function setCookie()
>       {
>       var cookietext =
> cookiename+"="+map.getCenter().lat()+"|"+map.getCenter().lng()+"|"+map.getZoom();
>       if (cookieexpy)
>         {
>         var exdate=new Date();
>         exdate.setDate(exdate.getDate()+cookieexpy);
>         cookietext += ";expires="+exdate.toGMTString();
>         }
>       // == write the cookie ==
>       document.cookie=cookietext;
>
>       // == Call GUnload() on exit ==
>       GUnload();
>       }
>
> I'm not sure if this is the best way to keep my geolocation search when I
> refresh my page?
>
> Thanks for your time and help

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to google-maps-...@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-api+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.

Reply via email to