When I run the following code:
created_script=document.createElement('script');
created_script.src='/javascripts/jquery-1.4.2.js';
created_script.type='text/javascript';
$(document.getElementById('fancybox-frame').contentWindow.document.head).append( created_script);
The script element is created in the iframe’s parent’s head tag and not the iframe’s head tag. Does anyone know how to fix this to be appended to the iframe’s head tag?
You can try this with jQuery, I was able to execute this successfully as long as the iframe domain, protocol, and port matches. Otherwise, it was treated as an unsafe attempt to access a different url.