The notes for IFrame at http://docs.mootools.net/Element/Element#IFrame
say:
If the IFrame is from the same domain as the "host", its document and
window will be extended with MooTools functionalities, allowing you to
fully use MooTools within it.
Yet I can't get this to happen. And the domain IS the same as the
host. (I even inserted an alert into the MT code to check this.)
I have tried with both an existing iframe and a one created by the
"new IFrame" invocation. No difference.
My code for the latter case, reduced to its simplest form, which still
fails, is:
BSel= new IFrame({id:'BSifr',src:'http://www.SameDomain.com/Test.htm',
events: {
load: function(){alert('The iframe has finished loading.');}
}
});
If 'Test.htm' includes
window.addEvent('domready', Init);
I get an error in FF of window.addEvent is not a function
though the 'The iframe has finished loading.' alert appears.
If I remove the window.addEvent('domready', Init); line from Test.htm
and instead invoke Init from the load event function as follows:
BSel= new IFrame({id:'BSifr',src:'http://www.SameDomain.com/Test.htm',
events: {
load: function(){
alert('The iframe has finished loading.');
BSel.contentWindow.Init()
}
}
});
thealert appears, then the result is
$ is not defined
on the first line of Init() in Test.htm, which is:
SCel = $('SC')
If I load MooTools gain within Test.htm i.e. in the iframe, all works
as intended. But from what the docs say, I should not need to do this.
What am I doing wrong, please, anyone?
Thank you!
David
PS: On logging on to post this I saw a post by TomWA007 "Iframe bug?".
I tried the change suggested in that post, but it did not help.