dom - Javascript - Iframe load all parent window scripts? -
how make iframe load parent window's scripts?
i thinking this:
<!doctype html> <html> <head> <script src="jquery.min.js"></script> <script src="somethingelse.js"></script> </head> <body> <iframe> <html> <head> <script> (var i=0;i<window.parent.document.scripts.length;i++){ var script = window.parent.document.scripts[i]; //now should append 'script' document.scripts (this iframe scripts array) } </script> </head> <body> </body> </html> </iframe> </body> </html> ps: made simple possible. real code bigger.
try:
for (var in window.parent.document.scripts){ var parentscript = window.parent.document.scripts[i]; var newscript = document.createelement('script'); if(parentscript.src) newscript.src = parentscript.src; if(parentscript.innerhtml) newscript.innerhtml = parentscript.innerhtml; document.head.appendchild(newscript); }
Comments
Post a Comment