javascript - Access to iframe Object.prototype in IE8 -
i have iframe element on page , need create prototype methods object inside iframe.
i got iframe window
var win = iframe.contentwindow || iframe.contentdocument.defaultview;
and tried create methods. in ff, chrome , ie9+ it's simple:
win.object.prototype.func = myfunc;
but doesn't work in ie8. got undefined in win.object. @ same time win.element works perfectly.
how can iframe object in ie8 ?
you can insert script
element in iframe
creates global variable in outer window points inner object
:
var doc = iframe.contentdocument, s = doc.createelement('script'); s.text = "parent.object2 = object;"; doc.appendchild(s); doc.removechild(s);
then, can use object2.prototype
.
Comments
Post a Comment