send postMessage from the web script to frame-script

83 Views Asked by At

On the frame-script.js, i cannot catch / listen to postMessages from the web scripts on the web page (nor to custom events).

However, i tried and was able to catch 'click' events.

What am i doing wrong?

post messaging like this :

window.postMessage(message, "*");

listening on the frame-script:

addEventListener("message", dosomething, false);

also tried

content.addEventListener("message", dosomething, false);

doesn't catch the postMessage.

1

There are 1 best solutions below

0
On

for extensions addEventListener has a 4th, proprietary argument to get untrusted events.