postmessage

Send keys without SendMessage and PostMessage

两盒软妹~` 提交于 2019-12-06 14:52:10
Is it possible to send keys to a program without SendMessage and PostMessage API? The official way to fake input does not involve sending or posting Windows messages directly. Instead you are meant to call SendInput . When you use SendInput it is indistinguishable from actually pressing the real keys. When you call SendInput to fake keyboard input, the system ultimately posts messages to the message queue of the foreground thread that created the window with the keyboard focus. 来源: https://stackoverflow.com/questions/10106725/send-keys-without-sendmessage-and-postmessage

HTML5 postMessage without window reference

好久不见. 提交于 2019-12-06 12:57:24
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 (even worst) WebRTC? (poor browser support) Is there a API I missed? BTW, No cross-domain is need. I am

How do I use postMessage() in Javascript?

拥有回忆 提交于 2019-12-06 08:36:12
Is it possible to use the postMessage() method in Javascript to do cross-domain POST , GET , PUT , etc. calls? If so, how? And how do I pass headers and data? This is a two way implementation, meaning that the page you want to call needs to have a callback that listens to such a message and give an appropriate response. You can't simply use it as a swap replacement for AJAX. The best method for that is to use a server-side proxy. See this page for an explanation of how postMessage works. Yes, it is possible. There is a nice demo of what exactly you want, here document.getElementById("iframe")

Communication between Chrome-app and a homepage with PostMessage

时光怂恿深爱的人放手 提交于 2019-12-06 03:33:31
问题 I need to be able to send postMessage from a Chrome App through a webview to the homepage and back. I have established PostMessage from the Chrome App to the homepage, and the PostMessage is also catched by the homepage and a new one is send back, but this PostMessage reply is not caught by the Chrome App. I can see that it is possible on the Chrome-App API.: The guest will be able to send replies to the embedder by posting message to event.source on the message event it receives. So the

window.postMessage()实现(iframe嵌套页面)跨域消息传递

本小妞迷上赌 提交于 2019-12-05 23:56:28
window.postMessage()方法可以安全地实现Window对象之间的跨域通信。例如,在页面和嵌入其中的iframe之间。 不同页面上的脚本允许彼此访问,当且仅当它们源自的页面共享相同的协议,端口号和主机(也称为“同源策略”)。window.postMessage()提供了一个受控的机制相对来安全地规避这个限制。 发送消息的基本语法: targetWindow . postMessage (message , targetOrigin , [transfer ] ) ; targetWindow 就是接收消息的窗口的引用。 获得该引用的方法包括: Window.open Window.opener HTMLIFrameElement.contentWindow Window.parent Window.frames +索引值 message 就是要发送到目标窗口的消息。 数据使用结构化克隆算法进行序列化。 这意味着我们可以将各种各样的数据对象安全地传递到目标窗口,而无需自己对其进行序列化。 targetOrigin 就是指定目标窗口的来源,必须与消息发送目标相一致,可以是字符串“*”或URI。 *表示任何目标窗口都可接收,为安全起见,请一定要明确提定接收方的URI。 transfer 是可选参数 接收端: window.addEventListener("message"

How can I do cross-domain postMessage?

别来无恙 提交于 2019-12-05 22:08:53
问题 The documentation for postMessage implies that cross-domain messaging is possible. However: // When the popup has fully loaded, if not blocked by a popup blocker That isn't a very clear note of how to actually do it. Imagine two websites: [Parent] hosted on qc-a.nfshost.com [Child] hosted on qc-b.quadhome.com In the parent: document.addEventListener('message', function(e) { alert('Parent got (from ' + e.origin + '): ' + e.data); e.source.postMessage('Round-tripped!', 'http://qc-b.quadhome.com

Testing postMessage with Jasmine async doesn't work

社会主义新天地 提交于 2019-12-05 21:08:07
问题 I'm trying to use Jasmine 2.0 to write unit tests for some logic in an AngularJS app, but the logic is inside an event listener. From the controller: window.addEventListener('message', function(e) { if (e.data === "sendMessage()") { $scope.submit(); } }, false); And from the test file: describe("post message", function() { beforeEach(function(done) { var controller = createController(controllerParams); spyOn($scope, 'submit'); window.postMessage('sendMessage()', '*'); done(); }); it('should

how to call window onunload event for iFrame button click where parent page and iFrame resides in different domain

不羁岁月 提交于 2019-12-05 20:32:19
I have button which opens an iFrame (which reside in domain say 'xyz') the iFrame loads the page which resides in another domain (say 'lmn') $("#templateSelectionFrame").get(0).contentWindow.location.href = url; url is from another domain (I communicate in different domain with Jquery 'POSTMESSAGE') when user clicks cancel button from iFrame i need to close the iFrame but before that it is necessary to show the page leaving message (ie. stay on page / leave page - this is alreday called on window.onbeforeunload ). var warnNavigateAway = true; window.onbeforeunload = confirmBrowseAway; //

Cross domain iframe resizer using postMessage

我的梦境 提交于 2019-12-05 16:16:58
I've read all the cross domain iframe posts here (my thanks to all of you!) and elsewhere. The postMessage script at cross-domain iframe resizer? works beautifully in Firefox 5 and up. It resizes the iframe every time a page is clicked within the iframe perfectly. But it doesn't resize at all in IE (7 8 or 9) on my computer. I checked the security settings and the one in IE for access across domains was checked to enable. Does postMessage not work in IE? - Or is there something else that needs to be added? thanks Peter It's a great script from thomax - it also works on so you can use iframes

Creating a custom message/event with Qt

笑着哭i 提交于 2019-12-05 15:27:45
I have an RPC thread that is calling back to me from that thread. I need to somehow inform Qt that it needs to make a function call from the main thread. In straight Windows I could do this by using a custom message and then posting that message to the message queue, e.g., I could create a WM_CALLFUNCTION message and pass the function pointer through wParam and the parameter (class pointer) through lParam . Has anyone an idea how I could do this with Qt? I've come across QCustomEvent but I have no idea how to use it or how to process it. Any help would be hugely appreciated! Edit: In the end I