سؤال

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