Make it possible for AMPs to handle offline state
See original GitHub issueMake it possible for AMPs to handle offline state, e.g. by disabling certain actions. A first step could be to listen to changes in connectivity and add a class amp-offline
to the body tag <body class="amp-offline ...">
if navigator.onLine === false
.
Then elements could be disabled via css:
amp-offline button.disable-when-offline {
pointer-events: none;
...
}
//cc @pbakaus @ericlindley-g
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:12 (11 by maintainers)
Top Results From Across the Web
25. Replication and High Availability — AMPS User Guide ...
For high availability, you build applications that are fault tolerant: that keep working as designed even when part of the system fails or...
Read more >16.10 - Down AMP Recovery - Teradata Database
Down AMP Recovery is a process that handles all changes to entire tables or rows, ... The down AMP is considered to be...
Read more >Audio Architect indicates devices are offline, or how do I go ...
The custom user interface panel's indicators that show online status for devices, such as amps and DSPs, are red or indicate that devices...
Read more >Actions and events - amp.dev
For example, the following is possible in AMP: ... toggleChecked(force=BOOLEAN), Toggles checked state of the target element. force is optional, ...
Read more >What is AMP? - The Complete Guide to Accelerated Mobile ...
This comprehensive guide details what AMP (accelerated mobile pages) consist of, the main benefits, how the framework compares to other web pages &...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
agree with the event as long as we make sure it does not happen on page load. So likely
on="onlineStatusChanged:act"
instead ofon="online:act, offline: act"
.AMP trying to detect “real” onlineness is an interesting idea! I am just worried we may not be able to invalidate the state quickly enough without constantly polling an endpoint ( e.g.
amp-list
initially fails to connect and we set tooffline
but there isn’t any other XHR from the page anymore and we never go back toonline
)We should bring this up with WebPlafroms to see if they can improve accuracy of
navigator.onLine
based on real data.It would be ideal if the online/offline detection could also account for the lie-fi state, that is, to show offline even though the WiFi is connected. This could conceivably be connected with the XHR service, yes? Any time that an
amp-list
oramp-live-list
etc. tries to load content from the server, it could update some state as to whether requests are failing.I wonder if having a new
amp-offline
body class would be enough? It would seem useful to me if there wereonline
andoffline
events that could be triggered on some element. This would then allow the page to set some state to change the body class and make other changes for offline mode. This would be more powerful than just toggling the body class alone.