Use jQuery to replace <body onunload="GUnload()">
When using Google maps it’s important to use GUnload on the page’s unload event. Fine when you can access the body tag directly…. But if you have the Google map functionality wrapped inside an ascx you need a different approach.
After a big of digging I found how to use jQuery to “catch” the unload event. In case anyone else needs it:
$(window).unload( function () { GUnload(); } );
This entry was posted by nerdboy on Monday, January 26th, 2009 at 5:03 pm and is filed under Javascript. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response below, or trackback from your own site.
6 Reader Comments (Reply Now)
February 3rd, 2009
@ 10:10 am
Thanks, I needed this.
May 19th, 2009
@ 9:24 pm
cheers bol, just what i needed
July 7th, 2009
@ 11:24 pm
Thanks a lot. This is just what I was looking for
August 26th, 2009
@ 8:57 pm
Thanks!
November 3rd, 2009
@ 12:19 pm
Thanks, exactly what I was looking for!
November 4th, 2009
@ 3:35 am
Does
$(document).unload( function () { GUnload(); } );
do the same trick?
Leave a Reply