Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

277
Vistas
How can I get JSON data from a browser extension (Chrome) from another server?

I am writing a browser extension that should periodically receive the exchange rate in the JSON format and place it in local storage. But when I try to do this in the code of a page of any site, I get error:

Access to XMLHttpRequest at 'https://my.server.domain/currency.txt' from origin 'https://developer.mozilla.org' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Sample request code

$updateUrl = "hhttps://my.server.domain/currency.txt";
$.get($updateUrl).done(function($updData) {

});

The only place where I can run a script like this is in popup.html, but I need updates to be triggered automatically. I tried to do it through Background but in manifest v3 there is no such possibility anymore.

The only option is to periodically open the update.html extension page and perform updates in it, but this happens by opening a new tab, and I would like to do this in the background.

Any tips?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

In general, I wrote this in background.js and it works

fetch("https://my.server.domain/currency.txt")
.then((response) => {
    return response.json();
})
.then((data) => {
    console.log(data);
});

It remains now to figure out how to make the script periodically update the data, otherwise it works only once. But that is another story.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda