tags:

views:

164

answers:

2

I need to stop all the javascript running on the page, but I have a limitation:

I cannot control the tags content, I am editing the page after it's being loaded.

Also, I need to remove all the variables defined by the old script that was running and stop all the intervals.

The solution I thought to stop intervals:

for(var i=0,s=setInterval(function(){},1e10);i<=s;++i)
    clearInterval(i);
for(var i=0,s=setTimeout(function(){},1e10);i<=s;++i)
    clearTimeout(i);
+2  A: 

No, not really.

I mean, you could probably find a way to hack it together, but there's probably a better way. Override certain components manually, if need be, but erasing is likely not the way to go.

As per your comment, if you're just dealing with your own local copy, why not save a copy of the page and remove the script tags?

Matchu
Because then google chrome won't let me send http requests to that site
M28
Looks like you're out of luck, unless you want to play something sneaky. For example, you could create your own web server to host the page on, that could act as a proxy for those AJAX requests you'd be hoping for.
Matchu
Good idea, but their system check the users by ip :(
M28
Your IP will still be the same if your server is a local server. Just install Apache.
Matchu
+2  A: 

Basing off of Matchu's suggestion. You could get a copy of Fiddler, modify the page locally to suit your needs, have Chrome proxy through Fiddler. Then you can tell fiddler that when it sees a request for the page of interest, serve the local file instead.

I've done something like this before to debug some Javascript compiled into a .NET assembly, so I wouldn't have to recompile for every script change, just refresh the page.

Matt S