74
Views
3
Comments
Solved
How to make a PWA offline even if we have internet connection?
Application Type
Mobile

I have created an offline PWA with Outsystems.The app is working fine both online and offline.But I need to have a toggle button where I can switch to offline mode even if I have an internet connection.Is that possible?

2021-05-04 12-43-07
Jeroen Bindels
Solution

Then the preferred way is to have a client variable to store the Offline/Online preferred setting (could be a boolean)

Create a toggle (in a settings page, or somewhere in the footer/header/menu) toggling this client variable between these online/offline states (in case of the boolean, between True/False)

Then you can disable buttons and check within the logic flow on the value of this client variable and act accordingly (every call to the server should be protected with this client variable check, this otherwise could trigger a connection timeout Exception)

2023-04-13 07-10-08
Geertjan Jacobs

Is this for testing purposes? Because Chrome Developer Tools (F12) has an option to disable your internet.

2023-07-20 11-15-41
Joe AJ

Hi @Geertjan Jacobs Its not for testing purposes. We are trying to add a feature where,  if the internet connection is not stable, the user can click the toggle button to go offline and use the app offline


2021-05-04 12-43-07
Jeroen Bindels
Solution

Then the preferred way is to have a client variable to store the Offline/Online preferred setting (could be a boolean)

Create a toggle (in a settings page, or somewhere in the footer/header/menu) toggling this client variable between these online/offline states (in case of the boolean, between True/False)

Then you can disable buttons and check within the logic flow on the value of this client variable and act accordingly (every call to the server should be protected with this client variable check, this otherwise could trigger a connection timeout Exception)

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.