-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FR] - Allow <amp-install-serviceworker> to register a SW hosted on a subdomain #18055
Comments
cc @andreban |
It looks like a form of 2 is supported, you can install a serviceworker on the For case 1, I don't think you really need |
So after thinking about this a bit more, I'm not sure we can remove the origin check. Otherwise, this could be used as a way of creating |
Is there a way for AMP to enforce that the |
My use case would be to use microsites on different domains to promote full PWAs and pre-warm their caches. |
@tomayac do you want these microsites to not host their own service worker? |
If you have no other need for a tracking iframe (using Perhaps we could count this as a tracking iframe as far as this piece of code is concerned: amphtml/extensions/amp-iframe/0.1/amp-iframe.js Lines 363 to 370 in 389ff3b
So you would get either a tracking |
@sparhami One issue might be a potential race condition: if the service worker installation has not happened within the 5s window, then the approach with @prateekbh No, the microsite would not need its own service worker. For clarification, I have implemented the microsite approach in this repo, once in regular HTML, once in AMP HTML. The README file documents the AMP issue. |
adding @jridgewell (owner of amp-install-serviceworker) to be re-assigned |
Hi all, any update on this ticket? |
/cc @ampproject/performance |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
Due to validations inside the component for the data-iframe-src attribute and for the src attribute, it's not possible to register a SW if the AMP page is hosted on a different subdomain than the PWA.
For some sites, though, this configuration is not uncommon.
Examples include:
Having AMP and canonical at the main domain (www.site.com), and the PWA and SW in a subdomain (pwa.site.com, app.site.com, m.site.com).
Having AMP pages on their own subdomain (amp.site.com), canonical on the main domain (www.site.com) and the PWA on a different one (pwa.site.com, m.site.com, etc).
On these cases, the registration of the SW from the AMP page will fail with the current implementation of the component, even when it would be possible to make the registration work inside an iframe (as explained on this post, for the most general case.
Would be interesting to allow cases like the ones mentioned before work.
The text was updated successfully, but these errors were encountered: