Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Looking for sending message from parent to iframe #16

Closed
apple77y opened this issue Dec 18, 2017 · 2 comments
Closed

Looking for sending message from parent to iframe #16

apple77y opened this issue Dec 18, 2017 · 2 comments

Comments

@apple77y
Copy link

I've found the way to send messagefrom iframe to parent, through using $sf.ext.message and posMessageCallback, but I cannot find a way to send a message from parent window to iframe.

I find one method in host.js, as you can see the below.

	/**
	 * Send a message to a child iframe.
	 *
	 * @name $sf.lib.dom.msghost.send
	 * @public
	 * @static
	 * @function
	 * @param {string} tgtID The HTML id attribute of the iframe element for which to send a message
	 * @param {string} data The string of data to send to the given iframe
	 * @returns {boolean} Whether or not message was send succesfully (note that this does not mean message was handled / recevied, only that sending was ok).
	 *
	*/

	function send_msg_to_child_iframe(tgtID, data)

Also, method of use (that I'm gussing)

$sf.lib.dom.msghost.send("leftAdPlacement", "myMessageText");

It looks like what I intended, but I still don't know how iframe gets message from parent.
(I'm concerning the alternative way using #9 if there's no way.)

Any help will be great.
Thx.

@seansd-zz
Copy link
Collaborator

you can't. . that method is not really intended for your own use, it's used from SafeFrames internally. There is purposefully no way to allow you to receive a postmessage in a safeframe right now. . .that's an on going discussion that has to be addressed via a rewrite of the message bus that I haven't gotten around too. . .

@apple77y
Copy link
Author

@seansd I've got it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants