ipapi-co / api

API for IP address lookup (ipapi.co)

Home Page:https://ipapi.co

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blocked by CORS policy

dutta-alankar opened this issue · comments

I'm using the example script at https://ipapi.co/api/?javascript#complete-location5 to use ipapi with javascript. But I get the following error. How do I fix this?

Access to fetch at 'https://ipapi.co/8.8.8.8/json/' from origin 'null' 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.
visitor-test.html:52 
        
GET https://ipapi.co/8.8.8.8/json/ net::ERR_FAILED 403 (Forbidden)

script used:

fetch('https://ipapi.co/8.8.8.8/json/', )
			.then(function(response) {
			  response.json().then(jsonData => {
				console.log(jsonData);
			  });
			})
			.catch(function(error) {
			  console.log(error)
			});

Can you please message our support team to get this resolved.