postmessage

PostMessage WM_KEYDOWN send multiply keys?

感情迁移 提交于 2020-01-09 05:33:26
问题 I have this code: public static void Next() { Process[] processes = Process.GetProcessesByName("test"); foreach (Process proc in processes) PostMessage(proc.MainWindowHandle, WM_KEYDOWN, VK_RIGHT, 0); } This code sents the Right Arrow key, i want to sent ALT+CTRL+RIGHT i tried this: public static void Forward() { Process[] processes = Process.GetProcessesByName("test"); foreach (Process proc in processes) { PostMessage(proc.MainWindowHandle, WM_KEYDOWN, VK_CONTROL, 0); PostMessage(proc

set fancybox height with jquery

[亡魂溺海] 提交于 2020-01-05 04:14:29
问题 I want to show a fancybox on my page displaying an iframe with a source of another domain that has dynamic height (since within the iframe I'll go to different pages or might have some dynamic content). I have access to the other domain's code as well. So I can use postMessage to send the iframe's source's height to my page. But I can't seem to figure how to change the fancybox's height through code. I tried setting the height of all the divs that contain the iframe, including the iframe

Send keys without SendMessage and PostMessage

匆匆过客 提交于 2020-01-03 03:08:05
问题 Is it possible to send keys to a program without SendMessage and PostMessage API? 回答1: 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:

Cross domain iframe resizer using postMessage

若如初见. 提交于 2020-01-02 06:01:33
问题 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

Can the PostMessage API be used to communicate with an Android WebView?

左心房为你撑大大i 提交于 2020-01-01 03:58:06
问题 I usually use the HTML5 PostMessage API to communicate information from my iframed content to the parent frame. Recently I've had my content used inside an Android WebView (as far as I can tell this is the native-Android equivalent of an iframe). Is there a way for the native app to listen for PostMessage events that I send up to them? I'm aware that addJavascriptInterface exists, I'm just hoping that there's a way to reuse my existing PostMessage code without writing something new. 回答1: I

Problems with window.postMessage on Chrome

牧云@^-^@ 提交于 2020-01-01 02:43:49
问题 I have been stuck on this for hours. I have a.html on http://example.com that contains an iframe with src to b.html on http://subdomain.example.com. a.html has some JS code to postMessage to the iframe. The code to postMessage is simple: iframe_window.postMessage('message', iframe_element.src) But this way, Chrome throws an error: Unable to post message to http://subdomain.example.com. Recipient has origin null. I have also tried: iframe_window.postMessage('message', 'http://subdomain.example

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

六眼飞鱼酱① 提交于 2019-12-31 22:30:11
问题 My main goal is: Going to my application, open a link there in a new tab, make something in the new tab and send an event to the parent-main tab to refresh. I have learned 2 techniques that doesn't do exactly what I need: postMessage - works as far as I know only on iframe and not on tabs window.opener - works only with window.open(url) that opens only new window and not new tab. How can I pass an event from the child to the parent using tabs? I'd be happy for a specific example for

Web Workers

风流意气都作罢 提交于 2019-12-31 02:36:50
Web Workers使得 html5 也可以使用类似后台异步化、线程化的操作,让假死、卡不再存在,非常适合httpreqeust/io等操作。 worker使用postMessage方法,发送请求,在处理时再通过postMessage返回给消息给创建者,它的onmessage方法会捕获进行处理 // 声明 var worker = new Worker("worker. js "); // 发送消息 worker.postMessage(str); // 返回 worker.onmessage = function (evt) { alert(evt.data); } // 异常 worker.onerror = function (evt) { alert("\n在第["+ evt.lineno +"]行发生错误: " + evt.message); } // 关闭 worker.terminate(); JavaScript Code(worker. js ) // 接受消息 his.onmessage = function (event) { var msg = event.data,  // 返回   postMessage(msg +'~~~~'); } 来源: https://www.cnblogs.com/luxx/archive/2012/04/10

探秘小程序(10):分享功能+webview

笑着哭i 提交于 2019-12-30 02:24:27
场景: 小程序页面用webview嵌入了h5页面,h5页面需要与小程序进行交互,h5页面内容不同,分享的链接也不一样 分享功能: 小程序的分享功能即用户点击小程序右上角,转发功能页面。可以指定分享卡片的标题,分享的图片,以及用户点击分享卡面的后跳转的地址demo如下所示: Page({    onShareApp Message: function ( res) {      if (res.from === 'button') { // 来自页面内转发按钮        console.log(res.target)      }      return {        title: '自定义转发标题', path: '/page/user?id=123'      }    } }) 下面重点来了,踩过的坑了解一下: ① onShareAppMessage,方法必须包含return,并且return 有效,何时无效呢?如果将return包裹在setTimeout这样的异步函数中便无效。 ②return中path,必须是小程序的页面路径 ③path中如果包含了其他参数,而参数中又包含了url链接,需要进行 encodeURIComponent/decodeURLComponent进行编码解码操作 ④webview想小程序发送消息时,    通过h5页面

前端跨域问题解决方案

谁说胖子不能爱 提交于 2019-12-26 10:26:04
背景: 同源策略:NetSpace公司引入,基于浏览器安全,防止浏览器收到XSS、CSFR等攻击。同源,即协议+域名+端口完全一致。 同源策略:为保障用户信息安全,防止恶意网站窃取数据的一种安全策略。 *** “同源”:协议相同、域名相同、端口号相同 同源策略限制的行为: Cookie、LocalStorage和IndexDB无法读取 DOM和JS对象无法获取 Ajax请求不能发送 解决方案: 方案一:JSONP 原理:通过script标签引入的js不受同源策略的限制,而XmlHttpRequest对象受到同源策略的影响。可以加载跨域服务器上的脚本,用JSONP获取的不是JSON数据,而是可以直接运行的JS脚本。 eg1:jquery function jsonpCallback(data) { console.log("jsonpCallback: " + data.name) } $.ajax({ url:"http://www.nanhuaqiushui.com:8080/login", type:"get", dataType:"jsonp", data:{ name: $("#name").val(), id: $("#id").val() }, cache: false, timeout: 5000, jsonp: "callback", /