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
4 answers

Facebook like button in site that uses post message spams console

I have a site that uses a lot of postMessage communication between iframes. Putting a Facebook like button in my site causes my debug console to get spammed with messages like Received message of type object from [domain], expected a string. This…
asutherland
  • 2,849
  • 4
  • 32
  • 50
0
votes
1 answer

How to pass parameters to a new tab without using url parameters

I have a site like www.mysite.com and I have there a link that looks like: My link I want to pass plenty of parameters to the new url, I tried that with adding url parameters but…
Alon
  • 7,618
  • 18
  • 61
  • 99
0
votes
1 answer

html5 PostMessage cross domain - opposite version

I have created PostMessage from one domain to another. in domain A I have frame of domain B. I can send message from A to B. now I want to do opposite of that. I need a button in the frame (on popUp windows). when I click there, I need to send…
user1454686
0
votes
1 answer

PostMessage unexpected behaviour

I'm having a funny ol' time with PostMessage, wondering if anybody could enlighten me. The method below processes the first left click but not the second, I did a bit of messing around and found that using a MessageBox and hitting OK even instantly…
Spark
  • 1,007
  • 1
  • 8
  • 26
0
votes
4 answers

How do you encode an Object in a Web Worker for it to be passed via postMessage?

Internally, Firefox will JSON encode an object passed via postMessage to and from the Web Worker. However, this only works in Trunk builds of Firefox (3.6+) and not in Firefox 3.5, so the question is really how to add backwards support of this…
Ahi Tuna
  • 1,253
  • 2
  • 14
  • 26
0
votes
1 answer

postMessage into object tag

I am trying to get the html inside an object respond to my postMessage, but I am unable to get the referencing correct. I've tried var object = $("#test_object").get(0).contentWindow; object.postMessage("run","*"); which works for iframe. But as…
Jason
  • 21
  • 1
  • 4
0
votes
1 answer

javascript postMessage sendback to host

i'm trying to reproduce the recommend button of facebook especially the sort of tooltip which appear on the host page. May be that out of my competence but i'd like to understand how FB do that. They implement an iframe with the Recommend button.…
pierreaurelemartin
  • 1,592
  • 1
  • 14
  • 22
0
votes
1 answer

Open popup from iframe > use that popup to forward the (opener) parent window (IE issue)

This code I have works in Chrome/FF/safari but not IE9. I am trying to figure out whats wrong with IE. Domain1.com has an iframe hosted on domain2.com - the iframe triggers a popup (hosted on domain2.com) and then a link on that popup a) forwards…
alexbooots
  • 383
  • 6
  • 22
0
votes
3 answers

VB.NET Send Tab key to another application window

I want to send "{TAB}" Key to another application window(send the key to the window not to textbox). I tried: SendMessage(hWnd, WM_SETHOTKEY, VK_TAB, 0) Nothing happened. my goal is: send tab key to my application Or other application when the…
Nmmmm
  • 187
  • 1
  • 2
  • 7
0
votes
1 answer

MS Word COM addin can't receive messages in XP

From inside my COM addin I create a dialog, and I then send messages to it from an external process. I use HWND_BROADCAST and RegisterWindowMessage. But those messages are never received by the dialog proc of the COM addin. I know this because I log…
sashoalm
  • 75,001
  • 122
  • 434
  • 781
0
votes
2 answers

JS - Resizing an Iframe based on it's content, without using timeout

I have an Iframe that communicate with it's parent (on other domain) using window.postMessage. on the parent window I have a resize method that can be called from the iframe. I want to add code to the Iframe that will watch for a content dimension…
Shlomi Schwartz
  • 8,693
  • 29
  • 109
  • 186
0
votes
1 answer

Cross Document Messaging - post objects feature check FF3.6

I am talking between a window and an inserted iFrame, using cross domain messaging. The code below is the iframe talking back to the parent window. sendToParent = function (event, response) { // send to parent …
Will Hancock
  • 1,240
  • 4
  • 18
  • 27
0
votes
0 answers

Creating lparam for postmessage

I am having trouble with creating lparam for postmessage. I know that application gets such key: WM_KEYDOWN nVirtKey: VK_CONTROL cRepeat:1 ScanCode: 1D fExtended:0 fAltDown:0 fRepeat:0 fUp:0 WM_KEYDOWN nVirtKey: VK_LEFT cRepeat:1 ScanCode: 4B…
Immons
  • 257
  • 1
  • 11
0
votes
1 answer

Any way to read elements from another website in an iframe?

I'm playing around with some stuff and trying to discern if when using a cross-domain iframe(post_message) if I can read the elements: div-tag p-tag etc of site within the iframe? I haven't seen any other posts on this, so hopefully someone can…
John Verber
  • 745
  • 2
  • 16
  • 31
0
votes
0 answers

How can I use authorize when accessed via window.postmessage in Javascript?

It seems window.postmessage that don't support authorization using username and password. (See) How can I authorize in postmessage like XMLHTTPRequest().open() meethod.(See) Thanks.
kinakomochi
  • 475
  • 4
  • 8
  • 14