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.97k stars 427 forks source link

Issue loading Trustpilot Widget (iframe) #484

Open seand52 opened 10 months ago

seand52 commented 10 months ago

Hi,

I'm testing out a Trustpilot widget in a brand new app and I'm getting issues when it has to load the iframe. I've set up the reverse proxy from widget.trustpilot.com to a cloudfront distribution and it seems to work properly because it can fetch all the necessary javascript without any CORS issues.

The issue comes when I load the trustpilot widget by doing window.Trustpilot.loadFromElement(ref.current, true);. In order for this to work I'm correctly forwarding Trustpilot.loadFromElement.

I get the error message Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://widget.trustpilot.com') does not match the recipient window's origin.

I read in the docs that iframes should work so I'm not sure if there's an issue with my implementation. Is this supposed to work or is there some issue with my implementation?

Here's a link to my implementation, it's a brand new React project and I have everything in this file https://github.com/seand52/partytown-test/blob/main/app/root.tsx#L57.

The iframe that is created seems to have my reverse proxy url as seen in the screenshot

Screenshot 2023-10-25 at 12 57 01

Any help is much appreciated, thanks!

lalitkumawat1m commented 10 months ago

Hello Team I want to work on this issue please assign to me

seand52 commented 10 months ago

@lalitkumawat1m Do you think this is an issue with partytown? Do you have any ideas what could be happening?

mariofernandu commented 8 months ago

Same problem with chatwoot

image

gioboa commented 8 months ago

@mariofernandu can you create a PR with a failing test pls? With this test in place, it's easy to fix up the issue. Thanks I saw your PR 👍 thanks