BuilderIO / partytown

Relocate resource intensive third-party scripts off of the main thread and into a web worker. 🎉
https://partytown.builder.io
MIT License
12.89k stars 427 forks source link

[🐞] Firefox: Private Browsing for external Scripts #582

Open sotasan opened 3 months ago

sotasan commented 3 months ago

Describe the bug

Hey,

apparently Firefox currently doesn't support service workers in private browsing mode, so the external third party scripts aren't being called at all, but the inline scripts work without a problem. Is there a way to support the external scripts like the inline scripts as a fallback or is there no way to get it working without the service worker?

Reproduction

https://github.com/sotasan/squalid-spectrum

Steps to reproduce

  1. pnpm install
  2. pnpm build
  3. pnpm preview
  4. Open http://localhost:4321 in Firefox's private browsing

Browser Info

Firefox

Additional Information

No response

kuraobi commented 3 months ago

I'm testing Partytown right now and spent a few hours figuring this out too.

After replacing this in the code snippet:

o=r.createElement("script")).innerHTML=l[n].innerHTML

with

o=r.createElement("script")).innerHTML=l[n].innerHTML,o.src=l[n].src

It works. I don't know anything about the project, but it may help fixing the issue.