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

145
Views
Why XMLHttpRequest status is 0

my background script.js:

let portFromCS;

function connected(p)
{
  portFromCS = p;
  // portFromCS.postMessage({greeting: "hi there content script!"});
  portFromCS.onMessage.addListener(function(m)
  {
    portFromCS.postMessage
    ({greeting: "In background script, received message from content script:" + m.greeting});

    let xhr0 = new XMLHttpRequest();
    xhr0.open("GET", "http://127.0.0.1:7878/"+m.greeting); //ok
    xhr0.send();
    
    let text = xhr0.status;
    
    xhr0 = new XMLHttpRequest();
    xhr0.open("GET", "http://127.0.0.1:7878/return/"+text); 
    xhr0.send();
    

  });
}

browser.runtime.onConnect.addListener(connected);

connect to my webserver,

returns

socket://127.0.0.1:52626
GET
/Data also provided by
socket://127.0.0.1:52636
GET
/return/0

means one xhr does what I want and the other doesn't

server : (writen by rust + poem)

#[handler]
fn index_test(remote_addr: &RemoteAddr, method: Method, uri: &Uri) -> String
{
    let uri = uri.to_string();
    let  uri = urlencoding::decode(uri.as_str()).unwrap();
    let s0 = format!("{}\n{}\n{}",remote_addr,method,uri);
    println!("{}",s0);
    s0
}

screenshot : open in browser

about 4 years ago · Juan Pablo Isaza
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!