javascripthtmlfirefoxgreasemonkeyadblock

Replace Execution Of Javascript File Loaded From Website With My Own


There is a counter on website http://example.com/website. This counter is executed from javascript file that is downloaded to computer.

It contains a function that updates a page after the counter hits 0 seconds. This javascript is loaded from http://example.com/scripts/timer.js and this load is called from http://example.com/website page within html like <script type="text/javascript" src="/scripts/timer.js"></script>

The goal is to change the time of the counter. So I tried the following using Firefox, GreaseMonkey and AdBlockPlus plugins:

  1. Downloading the original timer.js file and changing it (this works ok).
  2. Blocking execution of original "timer.js" with AdBlockPlus plugin (this works ok).
  3. Executing edited timer.js from my computer using GreaseMonkey plugin by replacing the source of the script within html of http://example.com/websites (this doesn't work).

I've already tried solutions provided previously here Greasemonkey - replace javascript src to load custom JS instead the one of the page and here Stop execution of Javascript function (client side) or tweak it but for some reasons they doesn't work at all. The timer counter doesn't show up on the webpage and I've spent a day to figure out how to make it work.

Maybe there is easier solution by using Firefox? If I understand correctly the main idea is right.

Thank You for Your help!


Solution

  • Currently I've found only a solution to download and install Fiddler web debugging proxy and change Firefox proxy settings to those specified in Fiddler. To execute edited file I've used Fiddler's rule to autorespond with local file when there is a request to specified URL.