I am creating a Chrome Extension for a webpage. The page has a script execute which changes the way the page is displayed by removing or emptying elements.
I found the <script>
tag that I need to delete or stop from executing. Is there a way to load the page into memory, parse it remove the <script>
tag and then load normally?
The only way I can remove the code via Javascript as of yet is to use Chrome Inspector to disable Javascript and then run the following code.
var scripts = document.getElementsByTagName('script');
for (i=0, max=scripts.length; i < max; i++){
var currentS = scripts[i];
var xInner = currentS.innerHTML;
if (xInner.indexOf('jsMenu1') < 1){
currentS.parentNode.removeChild(currentS);
}
}