Login  Register

Re: two way js communications between parent and iframe content

Posted by DL on Jan 10, 2011; 2:57pm
URL: https://discuss.orbeon.com/two-way-js-communications-between-parent-and-iframe-content-tp3192702p3207325.html

If I launch this test xform

http://localhost:8090/orbeon/xforms-sandbox/sample/custom-events

I see the popup message "hi there"

However when I try to loading this test xform into a client side iframe (name "orbeon_iframe" on another Apache server) ...

instead of seeing the popup message "hi there" this exception error comes up ...

"exception in client-side code"

when I click on "show details" I see this ...



Message: this._messageDialog is null
file: http://localhost:8080/orbeon/ops/javascript/orbeon/xforms/action/Message.js
line number: 67

I next searched for Message.js but soon realised this and other javascript files are bundled in
 
orbeon-resources-public.jar
and
orbeon.jar


I inspected the innards of the orbeon jars and this is the point in the javascript where the exception error occurs ...

_showMessage: function() {
// Create a span, otherwise setBody() assume the

// parameters is HTML, while we want it to be text

            var span = document.createElement("span");
            OD.setStringValue(span, this._messageQueue[0]);
            this._messageDialog.setBody(span);
            this._messageDialog.show();
        },
this._messageDialog is showing null .. so is this a DOM path referencing problem due to running in an iframe?

Does this javascript need to be modified to accommodate content appearing in a client side iframe?

Should I be using a DOM path like this in Message.js .. at a guess .. ???

objDoc = window.frames["orbeon_iframe"].document;

Do I have to unbundle the javascripts from the orbeon jars and edit them?

This returns to the general problem of addressing xforms embedded inside iframes in a client side script.