Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

170
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda