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
0
votes
0 answers

Firefox add-on to load webpage without network access

I'm wondering if Firefox can indicate that a webpage should be loaded but without network access (at least beyond its own directory). The purpose is to allow a file to conduct postMessage communications with a privileged add-on, but without there…
Brett Zamir
  • 14,034
  • 6
  • 54
  • 77
0
votes
0 answers

values in PostMessage method

I tried to get process of the PowerPoint by two diferent methods. Both working, but i can't send the key to inactive window. I took by the Microsoft Spy ++ the values: When I push the right arrow button, i see 3 logs. I get first one,…
MyWay
  • 1,011
  • 2
  • 14
  • 35
0
votes
1 answer

window.parent.postMessage parent check what iframe sent message

I need to know what iframe sent message to the parent window, as I'll have multiple iframes on one iframe hosting page. How can I check which of the frames sent the message?
Artek Wisniewski
  • 797
  • 5
  • 13
0
votes
1 answer

PostThreadMessage fails

I have created a UI thread. I m posting message to the UI thread which will write data in a file. I am using PostThreadMessage API to post the message to User thread. My Problem is it's not writing all the data that I have posted. For Instance, if…
Karthik
  • 11
  • 3
0
votes
1 answer

Event triggered when Window.postMessage() is fired

I've been reading up on using Window.postMessage() for cross-origin communication. From what I understand, when we fire the postMessage call to the other source from our window, we need to listen for response using the 'message' event handler. i.e.…
Prachi
  • 528
  • 8
  • 31
0
votes
1 answer

AJAX cross-domain "convert" to Postmessage

I have ajax cross-domain request. $.ajax({ type: "GET", url: url, success: function(xml) { $('.post-msg').append(processXml(xml, config)); }, error: function(jqXhr, textStatus, errorThrown) { …
Geray Suinov
  • 3,521
  • 3
  • 16
  • 19
0
votes
1 answer

Are PostMessage calls safe to a handle that's 0?

I have a datamodule with a HWND handle that receives PostMessage calls. The handle is allocated in the DataModuleCreate like this (TTNONVISUAL is not defined): {$IFNDEF TTNONVISUAL} FHWND := AllocateHWND(WindProc); {$ELSE} FHWND := 0; {$ENDIF} The…
Jan Doggen
  • 8,799
  • 13
  • 70
  • 144
0
votes
1 answer

VB.NET Sending Strings via Postmessage

OK, this problem has been bugging me for a long time. I have the code for the service which communicates a string to the client via PostMessage: Public Sub SendToClient(msgs As String, types As Integer, hwnd As Long) postMessage(hwnd, 0,…
user2444615
  • 41
  • 1
  • 7
0
votes
1 answer

Send or Post a message to notepad or msword dialog when application ask to save or not

The code below shows how to closed an application by filename. And it closes it without saving a document, If I point a filename in notepad, it doesn't closed directly, instead asking to save or not. I want to close the application with saving the…
XXXXXXXXXXXXXX
  • 155
  • 1
  • 3
  • 15
0
votes
0 answers

JSON.stringify(object)

So I'm uses this setup to send a JSON object through PostMessage plugin and on the receiving end I'm using $.parseJSON(result); The problem is stringify is adding a bunch of + symbols to the object where there are white space. So here is what I'm…
Chapsterj
  • 6,483
  • 20
  • 70
  • 124
0
votes
1 answer

Why does my cross-domain postMessage only work when passing "*" as origin parameter?

I'm working with 2 localdomains, localhost and domain1 to test a postMessaging system using iFrames from both domains. I can correctly identify the respective window element (on both domains) to send message to and receive replies. My problem is,…
frequent
  • 27,643
  • 59
  • 181
  • 333
0
votes
2 answers

Any gotchas using typeof window.postMessage === undefined?

I've got a webpage that won't work properly if postMessage is not available. I'd like to use a simple: if (window.postMessage === undefined) { //alert the user } Are there any unforeseeable issues with this approach?
Eric
  • 1,209
  • 1
  • 17
  • 34
0
votes
1 answer

Delphi, message handler and global variables thread-safety

I have one messagehandler in the form like this: procedure TMain_Form.form_message_handler(var MSG: TMessage); begin case MSG.WParam of 0: global_variable:=10; 1: global_variable:=global_variable+100; end; end; Several threads will send…
Artik
  • 803
  • 14
  • 36
0
votes
1 answer

Using PostMessage in Windows Mobile to simulate a menu pick

I'm writing a routine to provide user definable keyboard short-cuts for any menu item in my Windows Mobile 5 application, which is in C++/MFC. To do this I am getting all of the available menu command IDs, and using the…
SmacL
  • 22,555
  • 12
  • 95
  • 149
0
votes
0 answers

postMessage from local domain to remote domain

With tampermonkey I am running this Javascript inside an iframe in my page: document.addEventListener("message", function(e){ console.log('asd'); }, false); This way I could receive messages from parent window. I am using jQuery Mobile and have…
sites
  • 21,417
  • 17
  • 87
  • 146