load caja from iframes and load the caja lib ones in window.parent.caja

29 views
Skip to first unread message

o x

unread,
May 2, 2017, 3:53:02 AM5/2/17
to Google Caja Discuss
hello
i have a few iFrames loading the Caja lib..
so i have tried to load the lib from the parent page, but something get wrong..

        console.log(window.parent.caja);
        
       window.parent.caja.initialize({
        cajaServer: 'https://caja.appspot.com/',
        debug: true
      });

and Parent

$.getScript('//caja.appspot.com/caja.js', function () {
loadFunc();
});


i got this on the consul:
Uncaught TypeError: Cannot set property 'plugin_dispatchEvent___' of undefined
    at makeDomicileAndEmitter (ses-single-frame.js?debug=1:29542)
    at Object.makeES5Frame (ses-single-frame.js?debug=1:29456)
    at caja.js?_=1493711102536:264

Kevin Reid

unread,
May 2, 2017, 12:50:02 PM5/2/17
to Google Caja Discuss
On Tue, May 2, 2017 at 12:53 AM, o x <y.tra...@gmail.com> wrote:
hello
i have a few iFrames loading the Caja lib..
so i have tried to load the lib from the parent page, but something get wrong..
[...] 
i got this on the consul:
Uncaught TypeError: Cannot set property 'plugin_dispatchEvent___' of undefined
    at makeDomicileAndEmitter (ses-single-frame.js?debug=1:29542)
    at Object.makeES5Frame (ses-single-frame.js?debug=1:29456)
    at caja.js?_=1493711102536:264

In each of your frames, do

  caja.initFeralFrame(window);

before calling caja.load, and this should work.

o x

unread,
May 2, 2017, 11:54:49 PM5/2/17
to Google Caja Discuss
thank you Kevin Reid! that did the the trick :)
Reply all
Reply to author
Forward
0 new messages