Hi,
When using the metatag module and the sharethis module, the email share modal "breaks" the content of the iframe to sharethis.
I've narrowed this down in the metatag module to the meta tag "description" being applied that breaks the sharethis modal. If I "skip" the description meta tag being applied by the metatag module the sharethis iframe content does not "break." From looking at the source in the iframe to sharethis there is a meta tag "description" on the page with nothing set to content.
I've attached a screenshot of what the email share modal content in the iframe looks like with metatag module enabled.
SEE FIX BELOW!!!!!!
Comment | File | Size | Author |
---|---|---|---|
#13 | 2781541-13.patch | 606 bytes | naveenvalecha |
| |||
#9 | sharethis-n2781541-9.patch | 467 bytes | DamienMcKenna |
| |||
#4 | Working ShareThis email feature.png | 47.79 KB | bmsomega |
broke-sharethis.png | 34.77 KB | nathandentzau |
Comments
Comment #2
DamienMcKennaPlease upload a screenshot of what the popup looks like when Metatag is disabled.
Comment #3
bmsomega CreditAttribution: bmsomega as a volunteer commentedTesting this on a fresh D8 install still yields the issue. Also worth mentioning, both modules can be installed and the email feature for ShareThis will work properly. It's only when actually implementing a Metatag field to a Content Type does the issue happen.
Comment #4
bmsomega CreditAttribution: bmsomega commentedI've worked on this issue with @nathandentzau. This is what the email feature looks like when we remove the Metatag field from our Content Type.
Comment #5
nathandentzauHi all,
I've resolved this issue. The culprit was indeed the metatag module but more specifically the meta tag "referrer" which by default the metatag module sets to "no-referral". The reason it breaks the email modal for ShareThis is because the JavaScript file embedded on the external page ShareThis includes in an iframe is looking for page content from the "parent" page, but because the referrer metatag is set to no-referral the page data can't be accessed externally. In fact there is a JavaScript error on the page which led me to this conclusion:
st.7832885….js:1 Uncaught SyntaxError: Failed to execute 'postMessage' on 'Window': Invalid target origin '' in a call to 'postMessage'.
Solution:
- Go to /admin/config/search/metatag/
- Edit the Global Type
- In the Advanced section, go to Referrer policy and set that select box to "Origin"
If you have existing content on your site, which you most likely do, you'll need to update each content type manually:
- Go to the content and Edit it
- Go to the Meta tags section, then the Advanced section and set the Referrer policy to "Origin" here too.
- Make sure to clear cache for this change to update on existing content.
Any NEW content created will inherit the policy set in the metatag Global type.
Hope this saves you the hours of frustration we went through. :)
Nathan
Comment #6
DamienMcKenna@nathandentzau: Thanks for uncovering the problem. FYI the problem with the referrer meta tag was fixed in the current -dev release, see #2764163: Unable to not select the "Referrer" meta tag for details.
Comment #7
naveenvalechaMoving this to meta tag issue queue.
Added a followup issue #2788441: Specify in Readme.txt that Email modal content "breaks" when using metatag module to specify in Readme.txt that its a known issue.
Comment #8
DamienMcKennaGiven the fix to Metatag, I'd instead recommend listing it as a known issue in ShareThis, to avoid setting the "referrer" meta tag if using the email share feature.
Comment #9
DamienMcKennaHow's about something like this?
Comment #10
DamienMcKennaMaybe it'd be useful to add a note via hook_requirements too?
Comment #11
naveenvalechafixing component
Thanks for the patch!
Add "Known Issues" heading in the listings at the top of the file.
Comment #12
naveenvalechaNo, Adding in the Readme.txt is worth enough
Comment #13
naveenvalechaComment #14
Greg Boggsreadme updates as expected.
Comment #16
naveenvalechaCommitted and pushed to 8.x-2.x