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

SendMessage vs PostMessage + WaitForSingleObject

I was wondering what's the difference between calling SendMessage (which blocks) and calling PostMessage in conjunction with WaitForSingleObject. Thoughts?
Filip Frącz
  • 5,651
  • 11
  • 42
  • 65
11
votes
8 answers

Allowing two sites to communicate to know the current URL of an iframe

I'm trying to figure out a solution to allow an website to know what URL the user is on through an iframe. Website 1: http://website.website.com (Remote Website, can only add javascript & html to the webpage) Website 2: https://example.com (Fully…
Ryflex
  • 4,369
  • 22
  • 65
  • 135
10
votes
1 answer

Javascript Errors: "No relay set", only in IE 7, 8

My javascript won't load because of errors it receives, only in IE. I used debugger to get the following errors. This page renders the javascript correctly in Safari, FF and chrome but not in IE and only on specific pages like…
ToddN
  • 2,769
  • 14
  • 53
  • 93
10
votes
1 answer

Use common JS libs inside sandboxed iframes

I plan to build a module system for my webapp that uses sandboxed iframes and the postMessage API to securely run custom user modules. The iframe blocks all DOM access and should only communicate through an interface provided by me which checks some…
Stefan Blamberg
  • 806
  • 7
  • 21
10
votes
2 answers

window.postMessage between iframe and its parent with Angular: does anyone have a working example?

Does anyone have a working example of how to send and receive window.postMessage() calls in angular? I found the ng-post-message module on github and ngmodules, but I look at that code and it doesn't make a whole lot of sense to me and the…
K. Alan Bates
  • 2,914
  • 3
  • 25
  • 53
10
votes
1 answer

Why is postMessage script not working in IE8?

After extensive research it appears that this should work, but in IE8 the letsgo function never gets called... any help?