I've dug all the questions here, and, to proove the concept, what I've understood that if I want to catch a response from a request call - I have to alter the function that website implements. As I am not a front-ender, I do not quite understand the way it should be done...
I have the following code in Greasemonkey:
// ==UserScript==
// ==/UserScript==
(function() {
let originalFetch = unsafeWindow.fetch;
console.log(originalFetch); //*1
unsafeWindow.fetch = function monitorFetch (x, y){
let response = originalFetch(x, y);
let respo = response.clone();
return response;
};
console.log(unsafeWindow.fetch); //*2
The console from *1
prints
function monitorFetch (x, y)
and the console from *2
also prints
function monitorFetch (x, y)
But the website with this altering is not working - no thrown errors, I just see that requests that should be made are not being made.
I have also tried to find this original monitorFetch
function in website javascript and copy-paste it into Greasemonkey - the same result: no errors, no requests made.
What I want - is just to catch the response, I don't even need to modify anything.
Question: what am I not understanding, or doing wrong, or not doing?
Versions: Greasemonkey v4.11
Firefox v81