Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
quick check for online status with jQuery
//quick online/offline check
function hasInternets() {
var s = $.ajax({
type: "HEAD",
url: window.location.href.split("?")[0] + "?" + Math.random(),
async: false
return s >= 200 && s < 300 || s === 304;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment