0

I want my web app to know if it's online (to avoid my Google maps functions), so I use Offline.js. I'm trying to access an image from our website, but the web app is not hosted online (it's run locally), so the access is cross-domain. Here is my code in $(document).one('ready',:

Offline.options = {
    checks: {
        image: {
            url: 'http://www.portalogic.info/Images/portalogic.gif'
        },
        active: 'image'
    }
};

var on_line = Offline.check();
console.log(on_line);

But on_line = undefined. Why is this? Is there a different way to do this?

ManoDestra
  • 6,325
  • 6
  • 26
  • 50
xinthose
  • 3,213
  • 3
  • 40
  • 59
  • Looking at the docs, I don't see anything about `check` returning a value. I *do* see `Offline.on("confirmed-up", function() { ... })` is valid event listener, though. (As is `confirmed-down`, and many others.) – apsillers Jun 01 '16 at 19:46
  • 1
    This may help: http://stackoverflow.com/questions/29913099/offline-js-checking-while-online. And this: https://www.gavick.com/blog/detect-offline-browser – ManoDestra Jun 01 '16 at 21:07

0 Answers0