I’ve got two websites aaa.com and bbb.com. I want to, on button click, postMessage from website aaa.com to website bbb.com but cannot get it done.
I’m calling from aaa.com:
window.postMessage('this is test', 'bbb.com');
and listening on bbb.com:
window.addEventListener('message', function(e) { alert(e.data); }, false);
Please point me where I’m doing it wrong.
😉 oh, man , this way it won’t work at all, at least to my understanding
maybee this could help you:
basically if you want to send something to a site, the target-site should have a form (post) / url ( get ) where it accepts this. so you send a HTTP-REQUEST where your parameters/message is UrlEncoded.
i like the basic idea of what you trying to achieve, since this is not “so unrealistic” in application programming …. but the thing which is bothering you i think is the “stateless” http-protocl , and the fact that javascirpt is ClientSide-ONLY 😉
you possibly could build a javascript runnin on the client listening for connection… but thats also out of my scope — maybee someone else knows …
hope it helps
cu