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

790 questions
-1
votes
1 answer

SendMessage click (works only if the mouse is over the button)

I've done this before, but with this specific button, it doesn't work! If I click the button manually it creates a new window (mini-map): Image /////// But Programmatically I can see the animation on the button as if it gets clicked gif, But the…
w4po
  • 1
  • 4
-1
votes
1 answer

Using PostMessage() or SendMessage() to send uppercase letters

I'm trying to send uppercase letters or symbols (!@# etc), using the PostMessage() function: [DllImport("user32.dll")] public static extern IntPtr PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); I tried sending both shift and the…
SickGuy
  • 121
  • 1
  • 5
-1
votes
1 answer

How to automate UI keyboard input? pywin32 PostMessage vs Powershell SendKeys

Motivation: I'm using a software that doesn't have an API to interface with ... I have no alternative and have to open the software, send simple key sequence, then close ... Again and again, so I want to automate this process. Goal: Send…
techtana
  • 61
  • 7
-1
votes
1 answer

Accessing iframe.contentWindow.document not working using postMessage()

My goal is to add css to the iframe content from the parent page. I have two different domains one rendering an iframe from the other, I'm using postMessage to bypass the same-origin policy issue however this doesn't seem to work as expected. When I…
oma0256
  • 83
  • 1
  • 8
-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
  • 972
  • 1
  • 8
  • 24
-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
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
  • 1,661
  • 1
  • 18
  • 30
-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
  • 4
-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
  • 69
  • 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
  • 277
  • 1
  • 7
  • 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,106
  • 1
  • 18
  • 34
-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,109
  • 3
  • 20
  • 49
-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
  • 22,779
  • 27
  • 83
  • 163
1 2 3
52
53