Note that there are some explanatory texts on larger screens.

plurals
  1. POHTML5: using manifest fallback to check user's connectivity
    primarykey
    data
    text
    <p>I'm focusing on offline web applications with HTML5 at the moment. I came to the point where I need a reliable method of checking the user's connection to determine whether he/she is online or offline at the moment. Since I learned that the navigator.onLine property is highly unreliable I found a very nice method using the Fallback area of the cache manifest. I implemented two similar solutions from two different books, one being "Introducing HTML5" (Lawson/Sharp) and one "HTML5: The Missing Manual" (MacDonald). I guess this is an issue of HTTP caching (I use Apache and localhost), which I don't really know too much about. I pasted my code, it's a few files, but very little code.</p> <p>The adapted solution from Introducing HTML5: <a href="http://pastebin.com/UGsmnAtK" rel="nofollow">http://pastebin.com/UGsmnAtK</a></p> <p>The adapted solution from HTML5 - the missing manual: <a href="http://pastebin.com/8v5ck3E6" rel="nofollow">http://pastebin.com/8v5ck3E6</a></p> <p>Tested with Chrome 16...</p> <p>=== What I want ===</p> <ul> <li>start app with empty cache and running apache</li> <li>click the button -> alert "Online" is shown</li> <li>stop apache</li> <li>click the button -> alert "Offline" is shown</li> <li>start apache</li> <li>click the button -> alert "Online" is shown</li> </ul> <p>=== What happens ===</p> <p>Introducing HTML5 solution: - start app with empty cache and running apache - click the button -> alert "Online" is shown - stop apache - click the button -> alert "Online" is shown - start apache - click the button -> alert "Online" is shown</p> <p>HTML5: the missing manual solution: - start app with empty cache and running apache - click the button -> alert "Online" is shown - stop apache - click the button -> alert "Online" is shown - start apache - click the button -> alert "Online" is shown</p> <p>Other scenarios and use cases fail in similar fashion. The books promise that you can check the user's connectivity any time using their methods. So I guess I'm doing something wrong here. I would thankfully embrace any ideas on this topic.</p> <p>Cheers, Felix</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload