13

I can't find any way to remove and clean up a Google map when using the V3 API.

I've got it running in an AJAX site so I want to kill it off completely without the page having to be reloaded.

I was hoping for a .unload() or .deconstruct() method, but can't seem to find one.

Any thoughts?

sth
  • 222,467
  • 53
  • 283
  • 367
Jamie G
  • 1,653
  • 3
  • 20
  • 43
  • There is no such thing. V2 had `GUnload()`. Did you think about loading map into the iframe? – Cheery Feb 24 '12 at 19:30
  • Interesting idea, using it via an iframe would make cleaning it up nice and easy. It would mean reworking some of my website's controls though. Will certainly do this if I run out of other options! Thanks – Jamie G Feb 26 '12 at 10:23

1 Answers1

8

The V3 API should do a much better job managing it's memory. Does simply destroying the div that holds the map not meet your needs?

bamnet
  • 2,525
  • 17
  • 21
  • Unfortunately not, I remove the div that contained the Google map using jQuery's remove() method and I also remove the variable that holds the instance of the map, but still experience slow down on separate pages after visiting the map page - most noticeably on the iPad. NB: I'm afraid I can't post any code right now but might be able to in a week or so! – Jamie G Feb 26 '12 at 10:12
  • 3
    Looks like you were right Bamnet, due to a separate bug I wasn't actually removing the div containing the Google map on iOS. The process of working this out did teach me something very useful though - you can bring up a debug console on Safari iOS, it's under settings>Safari>Advanced>Debug console. I would have never found the bug without that! Hopefully that'll help someone else in the future. Thanks for everyone's help. – Jamie G Feb 29 '12 at 10:47