postmessage

How can I send an event from parent window to its child window?

做~自己de王妃 提交于 2019-12-11 11:15:05
问题 I want to send some event/data from parent window to its child window. How can I do so? I have tried postMessage , but it didn't work. 回答1: It has worked now, earlier I was doing some syntax mistake. Here is the correct code for the same. //parent Window childWindow=window.open("http:/localhost/abcd.php","_blank","width=500,height=500"); childWindow.postMessage('message',"http://localhost:80/child.php"); //child Window var newUrl=''; window.addEventListener( "message", function(e) { console

Chrome CustomTabs CustomTabsCallback onPostMessage not called

拥有回忆 提交于 2019-12-11 06:29:16
问题 I'm trying to work with the Chrome CustomTabs on Android, but I have a problem about use of CustomTabsCallback. So, I searched on the web some examples or documentation to implement in my code, but I unfortunatelly I did not find anything... I need to receive a postMessage sent by the hosted web page and read the content inside it. The postMessage was sent using "*" as origin, but I don't think that's the real problem. Here my code: CustomTabsClient.bindCustomTabsService(context, CUSTOM_TAB

Is the TForm.Handle thread safe?

让人想犯罪 __ 提交于 2019-12-11 03:04:42
问题 I routinely pass the main form handle to other threads so that they can post messages back to the main thread. I saw that on Sept 28, 2013, Remy Lebeau stated: ...the TWinControl.Handle property is not thread-safe, either. You should use the TApplication.Handle property instead, or use AllocateHWnd() to create your own window. in this answer to a question about passing strings. How is the handle property not safe? Does it change during the life of the program? 回答1: How is the Handle property

Programmatically change combobox

家住魔仙堡 提交于 2019-12-11 01:39:16
问题 I need to update a combobox with a new value so it changes the reflected text in it. The cleanest way to do this is after the combobox has been initialised and with a message. So I am trying to craft a postmessage to the hwnd that contains the combobox . So if I want to send a message to it, changing the currently selected item to the nth item, what would the postmessage look like? I am guessing that it would involve ON_CBN_SELCHANGE , but I can't get it to work right. 回答1: You want ComboBox

On javascript postmessage to parent HTML iframe that is on local disk

萝らか妹 提交于 2019-12-10 20:09:12
问题 I am working on a project that involves hosting a webpage in a iframe, while the hosting parent iframe is in a HTML file on local disk, say on c:\; while the inner hosted iframe is on some server. The two webpages need to do postmessage to each other. There is no problem for the parent iframe (on local disk) to postmessage to the inner frame, since it knows the domain of the inner iframe; But when the inner iframe need to postmessage back to the parent iframe, it need to provide the domain of

How to create C# Event to handle MFC Windows message from PostMessage()

不打扰是莪最后的温柔 提交于 2019-12-10 19:22:49
问题 I have a managed C++ DLL using WINSOCK. On receive it sends a custom message to a CWnd * via PostMessage(). This works fine when called from unmanaged C++. The target CWnd * is registered with the C++ class after construction using this code: // Registers a window (CWnd *) to receive a message when a valid // incoming data packet is received on this UdpRetrySocket. void CUdpRetrySocket::RegOnReceive(CWnd *i_pOnReceiveWnd, UINT i_RecvMsgId = WM_USER_RECV_DATA_AVAIL) { m_pOnReceiveWnd = i

Redirect a Popup and Post Message

放肆的年华 提交于 2019-12-10 15:42:11
问题 I am stuck in a problem where i have to redirect from a popup window to a different domain and post a message to it. Here is the scenario :- User opens a new popup window which stays in same domain.(ex: http://doamin_one.com) User fills the form in the popup window and clicks submit. This should redirect the window to http://doamin_two.com and domain_two.com should receive form data via post message. I am able to receive messages if i open fresh popup and do post message but not in the case

How to make postMessage applicable to all subdomains

痴心易碎 提交于 2019-12-10 12:31:04
问题 In window.postMessage second attribute specifies domain to which my message can be sent. Is there any way to specify that it is applicable to all subdomains. Things tried: iframe.contentWindow.postMessage('The message to send.','http://*.wordpress.com'); iframe.contentWindow.postMessage('The message to send.','http://wordpress.com'); 回答1: Nope, not possible. The only scenario in which you can help yourself is if you know that the target iframe is from a known, finite set of origins (e.g.

HTML5 postMessage without window reference

拥有回忆 提交于 2019-12-10 10:41:05
问题 The HTML5 postMesssage API allows sending message between window opener and openee. However, it requires reference/linkage to the receiver window. Is there a pure client side JavaScript way to broadcast events to all window subscriber, under same doaminname, opened by user (e.g. Duplicate Tab) same session, without help of server? For now, I come up with few ideas Server side channel (by $_SESSION) and polling JS Cooking update and polling (hard cookie play) localstorage update and polling

Communicating cross-origin from parent to child iframe

寵の児 提交于 2019-12-10 01:16:14
问题 I'm working through Third Party Javascript. I'm particularly interested in communication between a parent page and a child frame from a different origin. Using window.postMessage, it's trivial to safely send messages from the child and have the parent receive them with the message event. I have had no luck going the other direction. Can I get some confirmation that it is not possible to communicate from the parent to the child using postMessage? If not what are ways of working around this