[mapguide-users] Using Fusion functions from a seperate iframe

Paul Spencer pagameba at gmail.com
Thu Dec 4 21:44:23 EST 2008


Each frame is a separate document, which means it has its own 'window'  
global variable.  One of the members of window is parent which refers  
to the parent window of the current window.  Normally this is a self- 
reference but if you are using frames then it refers to the parent  
frame or frameset.  In your case, code running in map iframe can use  
window.parent to refer to the parent page.  There is another property,  
top which refers to the ultimate parent directly in the case of nested  
frames.  Window also has a frames member which can be used to  
reference the individual frames within the window.  So ... from the  
code iframe, you should be able to do something like this:

window.top.frames.map.someFunction();

which in this case is the same as:

window.parent.frames.map.someFunction();

Note that the same origin policy applies to frames, restricting access  
to frames that are loaded from different domains.

Cheers

Paul

On 4-Dec-08, at 8:50 AM, Jason Woodman wrote:

>
> I'm trying to access the fusion commands for a map from a javascript  
> function
> in a separate iframe.  Does anyone know how to do this and can  
> supply some
> pointers or sample code on how to get a reference to the fusion  
> commands in
> one iframe from another iframe.
>
> Here is my page setup
> -------------------------------
> | parent page                       |
> | --------------------------- |
> | | map iframe | code iframe | |
> | --------------------------- |
> -------------------------------
>
> My javascript function is in the code iframe, and I need to be able  
> to have
> it access the map functions in the map iframe so I can do things  
> like select
> objects, zoom to a selection, and the like.
>
> Thanks,
> Jason Woodman
> EMH&T, Inc.
> -- 
> View this message in context: http://www.nabble.com/Using-Fusion-functions-from-a-seperate-iframe-tp20833758p20833758.html
> Sent from the MapGuide Users mailing list archive at Nabble.com.
>
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users



More information about the mapguide-users mailing list