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

197
Views
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 answers
Answer question

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 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!