The amp-install-serviceworker
component allows installing a ServiceWorker for the current page.
The idea here is that this ServiceWorker runs whenever the AMP file is served from the origin where you publish the AMP file. The ServiceWorker will not be loaded when the document is loaded from an AMP cache.
See this article for how ServiceWorkers can help with making the AMP experience awesome with ServiceWorkers.
<amp-install-serviceworker
src="https://www.your-domain.com/serviceworker.js"
layout="nodisplay"
</amp-install-serviceworker>
Registers the ServiceWorker given by the src
attribute. If the current origin is different from the origin of the ServiceWorker, this custom element does nothing (Emits warning in development mode).
URL of the ServiceWorker to register.
Must have the value nodisplay
.