fediverse-embeds-wordpress-plugin icon indicating copy to clipboard operation
fediverse-embeds-wordpress-plugin copied to clipboard

mastodon-embed class missing on some embeds

Open stefanbohacek opened this issue 2 years ago • 1 comments

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 avatar Jul 30 '23 14:07 stefanbohacek

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

stefanbohacek avatar Jul 31 '23 00:07 stefanbohacek