Offline reading means readers can read articles when their device does not have a network connection, even if the article is server side rendered by Apps Rendering. DCR does not currently support offline reading.
Server side rendered articles link to assets, like javascript and webfonts, which can be fetched with a network request or from a cache on the device.
The iOS and Android apps use different mechanisms to add these linked assets to their caches:
iOS
The build process for AR produces a HTML file which references font and client script assets. The iOS app prewarms its cache on startup by fetching this HTML file and downloading the linked assets. Later, when an article is read but the device is offline, requests for these assets are served from the cache
this is probably because Apple does not allow an application to intercept requests made in a webview, unlike Android
Android
AR responds with a Link header. This specifies which client side assets should be prefetched. The Android app intercepts requests for these assets, and responds with a version from cache
How could we support offline reading during the migration of AR into DCR?
During the migration and until AR is deprecated, apps will need to support offline reading for two platforms: AR and DCR. This adds some complexity to the current setup.
Assuming that iOS restrictions mean requests for static assets can't be intercepted at asset load time, we might need to:
Produce a second HTML file via the same mechanism listing which assets should be cached for articles rendered by DCR
Produce a combined file listing all assets that should be cached for pages served by either AR or DCR
this might not be possible, as AR and DCR are built and deployed separately in different AWS accounts
Offline Reading
Offline reading means readers can read articles when their device does not have a network connection, even if the article is server side rendered by Apps Rendering. DCR does not currently support offline reading.
Server side rendered articles link to assets, like javascript and webfonts, which can be fetched with a network request or from a cache on the device.
The iOS and Android apps use different mechanisms to add these linked assets to their caches:
iOS
Android
Link
header. This specifies which client side assets should be prefetched. The Android app intercepts requests for these assets, and responds with a version from cacheHow could we support offline reading during the migration of AR into DCR?
During the migration and until AR is deprecated, apps will need to support offline reading for two platforms: AR and DCR. This adds some complexity to the current setup.
Assuming that iOS restrictions mean requests for static assets can't be intercepted at asset load time, we might need to: