Check If Internet Connection Exists in JavaScript


@kirupa This article was very helpful for me! By the way, I don’t think you need the random to avoid cached results. Because I don’t think a browser would ever return a cached HEAD request as doing so would defeat the point of the HEAD request. See Unfortunately, I couldn’t find any definite link confirming that no browser would ever cache a HEAD request. However, as the Stack Overflow answer explains, it may make sense for a browser to use the returned HEAD response to update its cache. But it really makes zero sense for a browser to visit its cache when making a new HEAD request.


That is a good point! I didn’t know this. I’ll fiddle with this some more and adjust the tutorial :slight_smile: