I have a site I'm loading via iframe and it's on the same server. I need to remove a certain script tag before the page inside the iframe is loaded. In order words, intercept and remove the script before it's executed.
I tried
var x = doc.getElementsByTagName('script');
doc.getElementsByTagName('head').removeChild(x);
But this doesn't seem to be able to catch the script before it executes. What other methods or options exist to achieve this objective?
Thanks
I don't think you can stop it from loading in the setup you've described.
However, you can point your iframe to your own server-side script (eg perl, php) which retrieves the URL and strips the script, then return everything else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With