Facebook embedded element is not working on Google Chrome
What's the issue?
Since a week ago facebook elements embedded using embedly stopped working, we switched to a new approach using an iFrame to display the elements, this approach does not work for Google Chrome nor Firefox.
How do we reproduce the issue?
https://codepen.io/anon/pen/pdgwjK
- Generate and embedly URL from a facebook video/image/post
- Add an AMP IFrame and set the previously generated URL as the source
- Load the page in Google Chrome or Firefox and check the console to see the errors
NOTE: This issue was discovered recently (about a week ago) and appears to be related to the way resources are embedded from Facebook pages, now they are loaded as script tags and that broke things in our site.
What browsers are affected?
Google Chrome and Firefox
Which AMP version is affected?
1508896929494
@rojasmi1 Any particular reason for not using amp-facebook component?
https://ampbyexample.com/components/amp-facebook/
If FB is disallowing iframe-based embeds, I am not sure if much we can do about it. Besides a dedicated facebook component that we already have.
@aghassemi We are currently moving to use the amp-facebook component, but I was asked to open an issue by one of the developers in Slack. The thing is that it perfectly works on Safari, which is kind of confusing. If you think this issue can just be ignored I'm fine with closing it, from our side we are already working on the solution.
@rojasmi1 I looks like the embed is trying to set document.domain which is not allowed in sandboxed iframes (AMP always sandboxes iframes). Safari may no be enforcing this or the code may not be trying to set it in the Safari case. None of the sandbox attributes (even allow-top-navigation) seem to relax this restriction.
I haven't managed to make that embed your work with a non-AMP iframe that has a sandbox attribute either.
Might be worth bringing this up with embedly to see if they know of a way to make it work in sandboxed iframes.
That was the first thing I did, but it looks like they can't do much about it. It might be worth bringing this up to Facebook as well then.
I'm closing the issue. Thanks for the quick replies!