0

I am trying to loop JSON data from the URL but message on console log net::ERR_BLOCKED_BY_CLIENT

<script>

 var url = "https://ssl.geoplugin.net/extras/location.gp?lat=14.5958&lon=121.0256&format=json&k=251a6dc5fb78066e";
 
 fetch(url)
 .then( (response) => response.text() )
 .then( (data) => {
     
     console.log(data);
     
 })
 .catch( (error) => console.log("Cannot get Data") );

</script>

Output:
https://www.screencast.com/t/Z8WrJJjh6
https://www.screencast.com/t/vBFp8Uz2Vc6Y

Code Issue

  • pretty sure it's your adblocker blocking the connection – Noriller Jun 21 '21 at 21:20
  • 1
    Does this answer your question? [Getting "net::ERR\_BLOCKED\_BY\_CLIENT" error on some AJAX calls](https://stackoverflow.com/questions/23341765/getting-neterr-blocked-by-client-error-on-some-ajax-calls) – disinfor Jun 21 '21 at 21:28
  • Hello @BrunoNoriller adblocker blocking the connection, What do you mean my adbloker? – nielsoffice Jun 23 '21 at 07:22
  • the link disinfor gave pretty much have everything... but the gist is that adblockers intercept calls based on the parameters and that causes that error. possible solutions? if you're talking production... maybe you would need some kind of proxy to bypass adblockers or you can catch the error and popup something to ask to disable the blocker in your page to have access to the content. – Noriller Jun 23 '21 at 13:14
  • Hello @BrunoNoriller thanks, have you snippet or link to make a popup disable AdBlock or that blocking? the app was obviously made in PHP and Vanilla Javascript. – nielsoffice Jun 23 '21 at 19:40
  • you cant just "disable" an adblock... you can basically do what those pesky paywalls do: "hey, it seems you're using a adblock" kind of thing. for that you could use the catch block, test if the error is that one and then trigger a modal to appear. – Noriller Jun 23 '21 at 22:34

0 Answers0