Google Maps API Tutorial© 2008, 2009 Mike Williams |
Translate this page: |
Communicating between iframesI don't think it's possible to pass references to complex Objects, like GMarker()s, between iframes. What you can do instead is to have "helper" functions in the target iframe that accepts simple Objects, like Numbers and Strings, and obtains references to the complex objects within that iframe.Here's a simple example This example has two iframes, one for the map and one for the sidebar.
Only frame1 loads the Google Maps API code. The helper function in frame2 takes the passed string and places in its local "side_bar" div.
Once the side bar has been passed, frame2 contains a series of calls like WarningDebugging Javascript that crosses between iframes is significantly harder than debugging Javascript that operates in a single frame. |