I am trying to add <script></script>
tag to an iframe
head or body but not able to succeed.
var iframe = $("iframe#demo),
contents = iframe.contents(),
body = contents.find('body');
Attempt one:
var script = document.createElement( 'script' );
script.type = 'text/javascript';
$(body).append(script);
Second attempt:
$("`<script></script>`").appendTo(contents.find('head'))
Either of the method above does not work for me.
Let me know if anyone has some pointer.
Thanks
Viral