1

Please note that this question is in consequence of another question: "Codename One - ToastBar when “No connectivity detected"

What is a correct approach (in Javascript or JQuery) to deal with Internet connection unavailability (that is common on mobile devices)?

Every time that there is a networking error, I would like to show a message to the user (like this one: https://i.stack.imgur.com/Ll6jD.png) and pause the Internet activity of the web page, in a way that no errors are generated (and the messages written by the user, for example in an html form, are not lost). The Internet activity should be (automatically) restored when the connection will be available again.

This should be a convenient way to allow people to interact with a web site (from mobile devices) without the risk of losing their posts or comments and without receive errors when they click a link.

This functionality should be as much as possible independent from the specific web site. What is a correct way to implement it?

Francesco Galgani
  • 6,137
  • 3
  • 20
  • 23
  • What solutions have you looked at? What have you considered? – TheCog19 Aug 24 '17 at 16:45
  • Maybe this? https://stackoverflow.com/questions/189430/detect-that-the-internet-connection-is-offline – yezzz Aug 24 '17 at 16:46
  • 1
    Hossein's answer is probably correct, you can inject code into the page after the on-load event and that way detach it from the functionality of the website – Shai Almog Aug 25 '17 at 03:23

1 Answers1

2

use jquery plugin like this : Offline.js

Hossein Oraee
  • 229
  • 1
  • 5