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

243
Views
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
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!