You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When loading devguide samples, the pageLoadFunctions.js fails with Cannot read property 'mapInit' of undefined, the expression being parent.parent.mapFrame.mapInit
The issue is that in the original AJAX viewer, the task pane is 2 frames down from the top level content.
For this viewer, the task pane is only 1 frame down (the iframe itself). However, the expression parent.parent.mapFrame.mapInit is still valid because window.parent == window is true for top-level content. That is to say, you can walk up the parent as many times as you want because at the top-level, a widows's parent is itself.
However, when this viewer is embedded in an iframe, this trick falls apart because the task pane content will actually try to walk 2 physical frames upwards because there are actually 2 levels of frame nesting (1. The task pane's iframe, 2. The iframe the viewer is in). Because our AJAX Viewer shim API is installed at the content window where the viewer is mounted, the task pane content skips over this frame and enters a parent content window where the shim APIs are not installed, hence the error.
The fix is to install the AJAX Viewer shim APIs at the viewer's content window and its parent. If not embedded in a frame, this would just install the shim APIs in the viewer's content window twice, which is inconsequential.
The text was updated successfully, but these errors were encountered:
Reported by Rémy Gourrat
http://osgeo-org.1560.x6.nabble.com/mapguide-react-js-embeded-in-div-or-iframe-issue-td5308462.html
When loading devguide samples, the pageLoadFunctions.js fails with
Cannot read property 'mapInit' of undefined
, the expression beingparent.parent.mapFrame.mapInit
The issue is that in the original AJAX viewer, the task pane is 2 frames down from the top level content.
For this viewer, the task pane is only 1 frame down (the iframe itself). However, the expression
parent.parent.mapFrame.mapInit
is still valid becausewindow.parent == window
is true for top-level content. That is to say, you can walk up the parent as many times as you want because at the top-level, a widows's parent is itself.However, when this viewer is embedded in an iframe, this trick falls apart because the task pane content will actually try to walk 2 physical frames upwards because there are actually 2 levels of frame nesting (1. The task pane's iframe, 2. The iframe the viewer is in). Because our AJAX Viewer shim API is installed at the content window where the viewer is mounted, the task pane content skips over this frame and enters a parent content window where the shim APIs are not installed, hence the error.
The fix is to install the AJAX Viewer shim APIs at the viewer's content window and its parent. If not embedded in a frame, this would just install the shim APIs in the viewer's content window twice, which is inconsequential.
The text was updated successfully, but these errors were encountered: