Proxytown

Run third-party scripts in web workers

Alternate implementation of Partytown with automatic cross-thread global variables support.

  • Third-party scripts can use DOM API and main thread globals automatically
  • Globals created in worker thread are usable in main thread automatically
  • Scripts created by third-party scripts execute in worker automatically
  • Lightweight - 6KB for all files combined

Usage

Get the Proxytown folder from proxytown-download.vercel.app, add the iframe to your page, and set type="text/proxytown" on third-party scripts.

<!-- Add Proxytown iframe -->
<iframe hidden src="path/to/proxytown/proxytown.html"></iframe>

<!-- Run third-party scripts in worker -->
<script type="text/proxytown" src="path/to/third-party-script"></script>