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

198
Visualizações
Global JavaScript Listener to block specific URL curl from background/child process

I have a JavaScript embedded in HTML using a sdk.js This SDK is using a compiled wasm file (not possible to decompile it), that child is performing a curl to a specific domain.

I am looking for a solution to include a global URL listener in my HTML JavaScript in order to block the curl to that specific domain.

Is this somehow possible? Does anybody has a clever idea to solve that issue?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

according to mdn on FetchEvent and mdn on Abortcontroller.abort() you could do something like

const el = document.querySelector('#exampleId')
const controller = new AbortController()
el.addEventListener('fetch', function(event) {
    if (event.request.url === "someUrl") {
        controller.abort()
    }
})

You will need to attach this event listener to the element that fires the request. if there are going to be multiple elements that do that then you can add the same class to each and use this code to add an event listener to each one:

const elsArray = document.getElementsByClassName('exampleClass')
const controller = new AbortController()
elsArray.forEach(el => {
    el.addEventListener('fetch', function(event) {
        if (event.request.url === "someUrl") {
            controller.abort()
        }
    }
})

never done that myself so let me know how it goes

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