0

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 i am determined to use the object tag. Is there a way to pass the postMessage through?

Jason
  • 21
  • 1
  • 4

1 Answers1

0

No, postMessage works only for iframes and windows/tabs.

Ivan Zuzak
  • 18,068
  • 3
  • 69
  • 61
  • 1
    You can do `objectEl.contentDocument.defaultView.postMessage(...)`. But you need to be in the same origin (same protocol, port and host) of the object's content to access to its document (`objectEl.contentDocument`). If you use `postMessage` that means it's not, so it's useless. – mems Oct 10 '14 at 16:50