i was wondering if i can add/append a javascript to an iframe which is loaded with an external web page that is not in my website. is it possible using jQuery or even simple javascript ?
<script>
// i need some code here
</script>
<iframe src="http://www.xxx.xxx/" id="myiframe" />
Note: i don’t want to replace the content of the iframe, i just want to add the script
Thanks
No, it’s not possible (and quite rightly too) because it violates the same origin policy. It would be rather a large security hole to allow users to script content that’s on another domain, anything would be possible from keyhooking to stealing personal data.