0

Hi Friends,

Working with communication between a child javascript window and parent jsp function, I am trying to access a function defined in the parent jsp from its child window which is a separate js file. This logic works fine in IE, but breaks in Chrome.
* Parent function: multiCreateCallback()

  • Child JS code to access multiCreateCallback
    [CODE]
    var windowCmp = parent.Ext.getCmp('workflowTaskWindow');
    var frameVar = windowCmp.getEl().dom.getElementsByTagName("iframe")[0];
    console.log("Frame test: "+ frameVar.contentDocument.frames.multiCreateCallback());
    [/CODE]

No matter what combination I use with frameVar, I can't seem to reach the callback function. 'contentDocument.frames' says undefined
'contentWindow.document.multiCreateCloseCallback()' also gives 'undefined' as error.
'parent.multiCreateCloseCallback();' - gave the error as - Uncaught TypeError: undefined is not a function

Is there any way to handle the code such that we can reach the callback function defined in the parent JSP?

Thanks in advance!
Nikita

2
Contributors
4
Replies
13
Views
3 Years
Discussion Span
Last Post by nikk8a
0

If I understand you correctly, you are trying to call a Javascript function, which is located inside the parent window, from an iframe (child of the parent window). If you are using JQuery, this post may answer what you want (using dolink). However, the function seems to be forbidden to use locally (with file:/// or drive letter in the URL).

0

Hi Taywin,

Thanks for the reply. I am using extJS and not jQuery, so can't make use of dolink.

0

Oops my bad. The dolink() is a function name defined inside your parent window. The window.parent is the object referred to your parent window. So inside your child (frame) window, use window.parent.AFunctionNameInsideParentWindow(). Hope this would give you some ideas.

0

I was able to resolve this using following snippet:

var windowCmp = parent.Ext.getCmp('workflowTaskWindow');
var frameVar = windowCmp.getEl().dom.getElementsByTagName("iframe")[0];
console.log("Frame test: "+ frameVar.contentWindow.frames.multiCreateCallback());
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.