Search code examples
javascriptvariablesreplacegreasemonkeytampermonkey

Replacing a JavaScript variable


When I click on a certain link the server writes if I have done it by stating either true or false in a text file... Just like this:

{"needs_click":false,"has_clicked":false,"sites":[{"id":2134,"name":"testing","has_clicked":false,"click_url":"http://testing.com?siteid=5433"}]}

Now what I have done is uploaded a text file to my FTP already and changed all the false results into true like this:

    {"needs_click":true,"has_clicked":true,"sites":[{"id":2134,"name":"testing","has_clicked":true,"click_url":"http://testing.com?siteid=5433"}]}

Now in one of the JavaScript files attached to the source code there is the variable at the top directing to the text file I just need to know how to make my browser read the spoofed link I created instead of the original. I need to change the variables:

var API_VERSION = 0.1;
var API_URL = "http://api.testwebsite.com/" + API_VERSION + "/";

To:

var API_VERSION = 0.1;
var API_URL = "http://api.testwebsite2.com/" + API_VERSION + "/";

So it reads the other text file stating all the true options instead of the original... any suggestions?


Solution

  • Was impossible, at the time I was very new to programming and limitations on what I could and could not do.