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

247
Vistas
How to fetch Wikipedia site?Access to fetch at * from origin * has been blocked by CORS policy

I am tring to display website from wikipedia on my site but i have problem with cors. Please can somone help me? I tried so many things but nothing work for me.

error:

Access to fetch at 'https://en.wikipedia.org/w/index.php?title=elon_musk&action=render' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

code:

<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <title>Document</title>
</head>
<body>
   <div id="content"></div>
</body>
<script>
    contentUrl = 'https://en.wikipedia.org/w/index.php?title='
    afterContentUrl = '&action=render'
    title="elon_musk"

    let url = contentUrl + title + afterContentUrl
    fetch(url)
        .then(function (response) { return response.text(); })
        .then((data) => {
           console.log(data)
           document.getElementById('content').innerHTML = data
        })
    </script>
    </html>

https://www.mediawiki.org/wiki/API:Main_page

Thanks:)

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