Skip to content

Commit

Permalink
Clarify hosting requirements for static assets (#4)
Browse files Browse the repository at this point in the history
* Clarify hosting requirements for static assets

Only the service worker script has to be hosted on the HTML page's origin. All other scripts can be hosted on other origins.

* Web workers also have to be same origin

* Make it clear that other scripts can be hosted anywhere
  • Loading branch information
lawnsea committed Sep 24, 2021
1 parent 49e304c commit f04786b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ To load Partytown with just HTML, the library script below should be added withi
<!--End Partytown-->
```

Note that the loaded script _must_ be hosted from the same origin as the HTML page, rather than a CDN. Additionally, the Partytown library should be hosted from its own dedicated root directory `/~partytown/`. This root directory becomes the [scope](https://developers.google.com/web/ilt/pwa/introduction-to-service-worker#registration_and_scope) for the service worker, and all client-side requests within that path are intercepted by Partytown.
Note that both the web worker script and the service worker script _must_ be hosted from the same origin as the HTML page, rather than a CDN. Additionally, the service worker must be hosted from a directory that ensures all HTML pages are within the [scope](https://developers.google.com/web/ilt/pwa/introduction-to-service-worker#registration_and_scope) for the service worker, so that all client-side requests from those pages are intercepted by Partytown. All other scripts can be hosted on any origin.

With scripts disabled from executing, the Partytown library can lazily begin loading and executing the scripts from inside a worker.

Expand Down

1 comment on commit f04786b

@vercel
Copy link

@vercel vercel bot commented on f04786b Sep 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.