Webapp warn user offline

Webapp warn user offline

  

I have a webapp where a screen action is triggered when fields in a table are changed by the user, server actions are called to update those fields in the database and AJAX updates the screen as necessary.

Problem is, if the user has a bad internet connection, i.e. they successfully load the page but then go offline without noticing, then the web app 'appears' to be all fine. The screen actions dont fail, no warnings or exceptions are triggered and so the changes the user makes are not saved.

I have tried putting in raise exception actions in the event that the server action does not return success, but I think that action doesn't even get called if the PC is offline. The web apps must have some neat logic to gracefully not call server actions from screen actions, but that means I have no way to alert the user if a data save is failing.

Thanks,

Danny

Hello Dan,

In the forge, there is a component that helps you creating offline web applications: https://www.outsystems.com/forge/Component_Details.aspx?ProjectId=479

You can check if there is anything else in the forge, simpler, that can help.

If this is too much and you really only need to warn the user, you probably will need to do this in JavaScript. The following is probably not available in all browsers, but it mention other techniques to discover online/offline: https://developer.mozilla.org/en-US/docs/Web/API/NavigatorOnLine/Online_and_offline_events

Hope this will help.

Cheers,
Eduardo Jauch

Thanks Eduardo. I have started trying to apply a javascript check that is run as a result of the user mouse-over-ing containers holding inputs. Sadly the online api isn't perfect as the computer can think its online when it isn't. I have started writing something to grab a 1px img from my OS env to really check that the connection is really working. Its not there yet, but will share the method if I get it going. At the moment getting stuck with how to record the online offline ness, need to use a timeout type js timer I think to give the old internet a chance to load things, the onload event must be usable somehow but at the moment I have the logic rather up the wrong way. I'll figure it out! Anyway, thanks!!!