I want to know if it is possible to add a javascript <script type="text/javascript">blahblah</script> to an iframe OR frameset that is on the page?
Just a note: the content comes from the same domain www.domain.com but the subdomain is different www.blah.domain.com vs www.blah2.domain.com, I’m not sure if that matters.
It does matter but luckily there’s a fairly simple fix. You just need to set the
document.domainproperty on both sides to the same domain (e.g.,document.domain = 'domain.com')document.domaincan only be set to the same super domain so you couldn’t do this withwww.example.comandblah.example2.com.Once you have the
document.domainproperty set you should be able to interface the iframe the same way you would if they were on the same subdomain.Here’s how to insert the script tag into the iFrame: Insert a Script into a iFrame's Header, without clearing out the body of the iFrame