How can I read the script loaded in iframe?
I want to resize the variable outside the iframe and want to use the variable in script.js out of iframe.
My code:
& lt; Script type = "text / javascript" & gt; Var myiframe = document.getElementById (ifr_id); Var script = myIFrame.contentWindow.document./*script.js*/; & Lt; / Script & gt; Iframe's & lt; Head & gt;
: & lt; Script type = "text / javascript" src = "script.js" & gt; & Lt; In
/ scripts & gt; .
script.js:
$ rootScope.texts = {content: 'inceptos suspendisse In addition, in time so far Nothing can happen in any kind of life, which works together with one another at that time of time. ', Copyright:' --- © 2014 Robbie Williams Interactive All Rights Reserved. ',};
- (but I want to vice versa)
read them like this
var scripts = myiframe.contentWindow.document.getElementsByTagName ("script"); (Var i = 0; i & lt; scripts.length; i ++) {if (script [i] .src) {console.log (i, script [i] .src); } Else {console.log (i, script [i] .winnerHTML); }}
This should work
or you can try to use myiframe.contentWindow.document.scripts
.
Comments
Post a Comment