Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

171
Views
Greasemonkey: one more what is the concept of intercepting/modifying fetch requests?

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

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Nevermind.

In general - the question remains.

But as for this particular case of mine - I was lucky: the website saves the data I am looking for in unsafeWindow.localStorage.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!