Inserting <script> tags into the iframe in the page, I just can't insert it.
1.jquery
for (Var i=0;i<scriptarray.length-1;i++) {
var script = document.createelement (' script ');
Script.type = ' Text/jacascript ';
SCRIPT.SRC = Scriptarray[i]; Fill in your own JS path
$ ("#viewPage"). Contents (). Find ("Body"). Append (script);
}
Append this method is the jquery<script> tag will be run by the browser to parse out, so it is not inserted DOM;
2.javascript
for (Var i=0;i<scriptarray.length-1;i++) {
var scriptdom = document.createelement (' script ');
Scriptdom.setattribute ("type", "Text/javascript");
Scriptdom.setattribute ("src", scriptarray[i]);
$ ("#viewPage"). Contents (). Find ("body") [0].appendchild (ScriptDom);
}
If you really want the element to appear in the DOM, do not use jquery attachments. Use native appendchild to achieve this.
Source: Https://stackoverflow.com/questions/610995/cant-append-script-element
JavaScript insertion <script> Tagging