Google Maps JavaScript API V3 - Unload / Deconstructor / Delete / Remove
11,494
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?
Related videos on Youtube
Author by
Jamie G
Updated on June 28, 2022Comments
-
Jamie G almost 2 years
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?
-
Jamie G about 12 yearsUnfortunately 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 about 12 yearsLooks 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.