html - inject javascript to iframe before rendering -
i'm using prototype of "appendchild" intercept calls "appendchild" , inject javascript "" of iframe, when error because when try inject code iframe still not ready i'm getting empty iframe null in contentdocument.
my code:
window.callbackfunc = function(elem, args) { (var key in elem) { if(elem.hasownproperty(key) && elem[key].id && elem[key].id.includes('testframe')) { console.log("start"); console.log(elem); } } } window.f = element.prototype.appendchild; element.prototype.appendchild = function() { window.callbackfunc.call(this, arguments); return window.f.apply(this, arguments); };
the output in console iframe object empty.
can add javascript head of iframe before ready? in exact point print in code?
Comments
Post a Comment