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

100
Visualizações
Javascript fetch stopped working for local files

I have a tiny HTML/CSS/JS app I use to read and play certain types of files. I have no need for it to be on a server.

As of yesterday, it "worked." Suddenly, today I'm getting an error about using fetch with local files. I did make some settings changes on my Windows 10 laptop.

abcjs-init.js:15 Fetch API cannot load file:///E:/OneDrive/Documents/ABCJS-Minimal-Editor-Notation-Player/tunes/tune_list.txt. URL scheme "file" is not supported.

This is my code:

fetch(tunes_list_path,  {mode: 'no-cors'})
    .then(response =>
    {
        console.log("response:", response);
        return response
    })
    .then(data => 
    {
        console.log("data:", data)
        return data.text()
    })
    .then(Normal =>
    {
        console.log("got tunelist");
        console.log("tune_list");
        
        let  tune_list = Normal.split("\n").sort();
        addTunesToSelector(tune_list);
    })
    .catch(err =>
    {
        console.log('Fetch problem show: ' + err.message);
    });

Further up is: let tunes_list_path = "tunes/tune_list.txt";.

The index.html loads fine. I can also view the file in the error directly with its URL. So it is visible to the browser.

Do I need to enable something in my browser? Add something to the fetch call?

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

0

Aha! I had changed a setting in Firefox that allowed COORS with local files: privacy.file_unique_origin.

I apparently erased that setting during my OS maintenance.

This solution is only for FF. There may be an equivalent setting for Chromium-based browsers.

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