I need to know what iframe sent message to the parent window, as I'll have multiple iframes on one iframe hosting page.

How can I check which of the frames sent the message?

有帮助吗?

解决方案

You can only check which domain sent the message. If you need more identification you can always layer it into your messaging system.

Send messages like:

message = {
    "source": "menu",
    "message": "click on entry"
};

Each frame then has their own source. You will need to serialize the message, JSON works nicely.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top