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!!!!!!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nathandentzau created an issue. See original summary.

DamienMcKenna’s picture

Title: Email modal content "breaks" when using metatag module. » Email modal content "breaks" when using metatag module
Issue tags: +metatag

Please upload a screenshot of what the popup looks like when Metatag is disabled.

bmsomega’s picture

Testing 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.

bmsomega’s picture

Working ShareThis email feature
I'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.

nathandentzau’s picture

Issue summary: View changes
Status: Active » Fixed

Hi 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

DamienMcKenna’s picture

@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.

naveenvalecha’s picture

Project: ShareThis » Metatag
Version: 8.x-2.0-beta3 » 8.x-1.x-dev

Moving 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.

DamienMcKenna’s picture

Project: Metatag » ShareThis
Version: 8.x-1.x-dev » 8.x-2.x-dev
Status: Fixed » Active

Given 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.

DamienMcKenna’s picture

Status: Active » Needs review
FileSize
467 bytes

How's about something like this?

DamienMcKenna’s picture

Maybe it'd be useful to add a note via hook_requirements too?

naveenvalecha’s picture

Component: Code » Documentation
Status: Needs review » Needs work
Issue tags: +Novice

fixing component
Thanks for the patch!

+++ b/README.txt
@@ -25,6 +25,11 @@ CONFIGURATION
+KNOWN ISSUES

Add "Known Issues" heading in the listings at the top of the file.

naveenvalecha’s picture

Maybe it'd be useful to add a note via hook_requirements too?

No, Adding in the Readme.txt is worth enough

naveenvalecha’s picture

Status: Needs work » Needs review
FileSize
606 bytes
Greg Boggs’s picture

Status: Needs review » Reviewed & tested by the community

readme updates as expected.

naveenvalecha’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x-2.x

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.