Questions tagged [postmessage]

The window.postMessage() method safely enables cross-origin communication between Window objects; e.g., between a page and a pop-up that it spawned, or between a page and an iframe embedded within it.

Cross-document messaging (aka postMessage) is an API introduced in the WHATWG HTML5 draft specification, allowing documents to communicate with one another across different origins, or source domains. Prior to HTML5, Web browsers disallowed cross-site scripting, to protect against security attacks.

See MDN Window.postMessage() API Reference

Related APIs

863 questions
-1
votes
1 answer

Process.Start with UseShellExecute fails to bring notepad.exe window to the foreground after a previous close window

I am trying to use Process.Start (with UseShellExecute=true) to create an instance of notepad.exe. The code below runs inside of a COM object called by another program (a voice-input program). Most of the time the code runs fine and creates the…
Kevin
  • 1,548
  • 2
  • 19
  • 34
-1
votes
1 answer

Angular Communication between 2 window of same Component

I am trying to implement communication between two windows. I open a component new 2 window by using Window.open(). The problem its same component 2 different instance in 2 windows not able to communicate between that 2 windows. Can you please…
-1
votes
3 answers

How is the LPARAM of PostMessage() constructed?

I'm having trouble with the parameter LPARAM of PostMessage(). This is a widely available example of the letter z being typed with PostMessage(): PostMessage(handle, WM_KEYDOWN, 0x5A, 0x002C0001) // key down for z PostMessage(handle, WM_KEYUP, 0x5A,…
John
  • 17
  • 4
-1
votes
1 answer

Event Listener call back function not called

I'm trying to send a custom event from iFrame source to the parent. I've referred to Html5 - Cross Browser Iframe postmessage - child to parent? but I'm still not able to get the event to my parent. Below is the code from iFrame source where I'm…
eureka19
  • 2,731
  • 5
  • 26
  • 34
-1
votes
1 answer

Why my postMessage does not working properly?

I have a index page contains the iframe element, this iframe refer to another DOMAIN page. and i need to get the data from iframe page, so i applied the postmessage concept. but it does not working. index.html
Coder_07
  • 27
  • 5
-1
votes
1 answer

Can't get MessageEvent properties

window.addEventListener('message', function (message) { console.log(message.data) // undefined } window.addEventListener('message', function (message) { var myMessage = message console.log(myMessage.data) // 'success get…
Yao Z
  • 13
  • 2
-1
votes
1 answer

Sending keystroke/mouseclick via PostMessage() in C#

I already got mouseclick to work with one issue. If I set delay between WM_MBUTTONDOWN and WM_MBUTTONUP to more than 5 ms it won't work. Why is that? [DllImport("user32.dll")] public static extern IntPtr PostMessage(IntPtr hWnd, uint Msg, IntPtr…
guuczi
  • 79
  • 1
  • 1
  • 6
-1
votes
2 answers

how can i execute a javascript call from iframe to the main window?

I need to execute a javascript call show(); from iframe to the main window using postMessage. This answer shows how to use postMessage, but not how to call a function on the main window. How can I call a function on the main window?
-1
votes
1 answer

javascript windows postMessage return message after initial event

I am passing a message between 2 domains, number 1 is www.domain1.com/stuff and number 2 is www.domain1.com:8888/stuff/ (Its a python rest API) I am sending data from 1 to 2 using the following code which is perfect and works... var popup =…
whoopididoo
  • 411
  • 2
  • 10
  • 19
-1
votes
1 answer

SendKeys with C# PostMessage - Underscore

I'm trying to send an underscore with PostMessage but the best I can get is -, can anyone help here I cannot find the answer anywhere. I send a string to a character loop that gets each one and uses PostMessage to send the key, which works fine for…
Aaron Gibson
  • 1,280
  • 1
  • 21
  • 36
-1
votes
1 answer

Change click trigger to on ready from event

How can I change the following function to trigger on document ready instead of on click? I initially removed the button and changed el.addEventListener('click', function() to document.ready(function(), but not sure what I'm missing. //when button…
Matt
  • 1,239
  • 4
  • 24
  • 53
-1
votes
1 answer

How is this not a hole in postMessage security?

Suppose I'm using the postMessage() API to communicate between frames on different domains. The standard security check in the receiving frame is to verify the origin property of the message event like: if ( messageEvent.origin !==…
-1
votes
1 answer

web worker postMessage() throws exceptions on functions in class - sometimes

Updated: I have typescript classes that have functions in them and I can pass those classes using postMessage fine. But the following class with a variable that is function fails. For the code below calling doitSuccess() succeeds. Calling…
David Thielen
  • 28,723
  • 34
  • 119
  • 193
-1
votes
1 answer

Get Vimeo video duration with manual api call

I simply want to get the duration of a vimeo video. I don't want to use froogaloop. The API states: "You interact with the player by sending a serialized JSON object with postMessage() to the . The following format should be used: { "method":…
Galbota
  • 63
  • 9
-1
votes
1 answer

IE passes an empty event object with PostMessage

All versions of IE do this. And all other browser work properly.. My code : window.addEventListener("message", receiveMessage, false); Which passes to : function receiveMessage(event) { console.log ( JSON.stringify( event ) ) ; Which, in…
Trip
  • 26,756
  • 46
  • 158
  • 277
1 2 3
57
58