stefanbohacek / fediverse-embeds-wordpress-plugin

Embed fediverse posts on your WordPress site.
https://wordpress.org/plugins/fediverse-embeds/
MIT License
39 stars 1 forks source link

mastodon-embed class missing on some embeds #20

Open stefanbohacek opened 1 year ago

stefanbohacek commented 1 year ago

Example post: https://mastodon.social/@Mastodon/110640658973976934

When embedding from mastodon.social, embed code looks like this:

<iframe
  src="https://mastodon.social/@Mastodon/110640658973976934/embed"
  class="mastodon-embed"
  style="max-width: 100%; border: 0"
  width="400"
  allowfullscreen="allowfullscreen"
></iframe>
<script src="https://mastodon.social/embed.js" async="async"></script>

When embedding the same post from my own instance stefanbohacek.online:

<iframe
  src="https://mastodon.social/@Mastodon/110640658973976934/embed"
  width="400"
  allowfullscreen="allowfullscreen"
  sandbox="allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-forms"
></iframe>

When embedding a post from my own instance, the class is present.

<iframe
  src="https://stefanbohacek.online/@stefan/110571664231037033/embed"
  class="mastodon-embed"
  style="max-width: 100%; border: 0"
  width="400"
  allowfullscreen="allowfullscreen"
></iframe>
<script src="https://stefanbohacek.online/embed.js" async="async"></script>

The mastodon-embed class is needed to determine which iframe is a Mastodon embed. Without it, or other specific identifiers, it would be necessary to check each domain in an iframe to see if it's a Mastodon server.

stefanbohacek commented 1 year ago

I opened a ticket in the Mastodon repo. https://github.com/mastodon/mastodon/issues/26265