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

254
Visualizações
local images not loading due to cors error

When I try to load local images into my web project, I am getting the error

Access to XMLHttpRequest at 'file:///C:myFilePathHere' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https.

I'm getting a cors error when requesting images/files that are in the same file path as the index.html file when I try to just open the html file on my browser. However, I don't get this error when using a webpage preview on visual studio code.

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

0

If you try to access file from "file:///" you are doing a request in another domain, not "http://localhost". I suggest you to access a file from a standard url in http or https.

about 4 years ago · Juan Pablo Isaza Relatório

0

You can try to run your server using --allow-file-access-from-files like this example

$ /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome  --allow-file-access-from-files index.html 
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