Remove script from site before executing
I have a site that I load via an iframe and on the same server. I need to remove the script tag before the page inside the iframe is loaded. In order of words, intercept and remove the script before executing it.
I tried
var x = doc.getElementsByTagName('script');
doc.getElementsByTagName('head').removeChild(x);
But it doesn't seem to be able to catch the script before it is executed. What other methods or options are there to achieve this goal?
thank
+3
user2028856
source
to share
2 answers
I don't think you can stop it on boot in the setup you described.
However, you can point your iframe to your server-side script (like perl, php) which fetches the url and splits the script into it and then returns the rest.
+1
vol7ron
source
to share
<script type="text/plain">
alert('foo')
</script>
0
Shanimal
source
to share