# Check If Internet Connection Exists in JavaScript

**URL:** <https://forum.kirupa.com/t/check-if-internet-connection-exists-in-javascript/352214>\
**Category:** programming\
**Created:** [November 23, 2014, 2:09am UTC](https://forum.kirupa.com/t/check-if-internet-connection-exists-in-javascript/352214 "2014-11-23T02:09:49Z")\
**Posts on this page:** 1\
**Showing post:** 30

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [April 15, 2021, 5:59pm UTC](https://forum.kirupa.com/t/check-if-internet-connection-exists-in-javascript/352214/30 "2021-04-15T17:59:21Z")

</div>

You are running into a CORS-related security issue. The server you are accessing can specify whether arbitrary endpoints (aka not a page on the same domain) can call resources on it. Imgur has a permissive CORS policy specified, but the server you are accessing does not. That’s the problem you are running into.

You can use a proxy to fake the CORS permission. You can see how I did that in this example: [Checking If A File Exists - #11 by kirupa](http://forum.kirupa.com/t/checking-if-a-file-exists/399354/11)

Let me know if this works for you!

Cheers,  
Kirupa

---

_[View the full topic](https://forum.kirupa.com/t/check-if-internet-connection-exists-in-javascript/352214)._
