1

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!

Community
  • 1
  • 1
Samuel
  • 83
  • 2
  • 14
  • @wOxxOm it doesn't use Date. I've already changed the file correctly but I can't load it on a webpage while the original file is blocked – Samuel Sep 03 '16 at 14:11
  • It is possible to do this (at least with tampermonkey, so I'm assuming Greasemonkey too) see https://stackoverflow.com/q/22141205/1214236 – Alowaniak Jul 01 '23 at 10:34

2 Answers2

2

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.

Samuel
  • 83
  • 2
  • 14
0

As you can said, can use of Fiddler web debugging proxy.

Firstly set proxy on browser: 127.0.0.1:8888 to pass traffic through Fiedler.

Solution #1:

Then from AutoResponder tab set http://example.com/scripts/timer.js address to http://example.com/scripts/timer_2.js new address as below image:

enter image description here

Solution #2:

Or another way can you can use QuickExec command line in bottom of window, and this command:

urlreplace timer.js timer_2.js

In this way, all addresses containing the phrase timer.js to timer_2.js will be replaced and new addresses will be loaded.

Solution #3:

Alternatively, type in the command line:

bpa http://example.com/scripts/timer.js

enter image description here

with do this, put a break point on the response. You can then modify the content of the page before it reaches the browser.

Nabi K.A.Z.
  • 9,887
  • 6
  • 59
  • 81