Skip to content

Child iframes (iframes within the activity iframe) shouldn't be allowed to communicate with DiscordSDK. #283

Description

@real2two

I'm currently working on an activity involving iframes...

When I was trying to send a message to the activity iframe (<Window>.postMessage) from a (same-origin) child iframe, DiscordSDK would pick it up on the handleMessage event as well, so I ran into these errors:
image

I don't want the child iframe from being able to send messages to DiscordSDK, so it would be nice if there was an option to add if (event.source !== this.source) return; to disallow this from happening below this code segment:

private handleMessage = (event: MessageEvent) => {
if (!ALLOWED_ORIGINS.has(event.origin)) return;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions