Долго искал решение и нашел.
Мы можем использовать postMessage!
if (window.addEventListener) { window.addEventListener ("message", receive, false); } else { if (window.attachEvent) { window.attachEvent("onmessage",receive, false); } } function receive(event){ var data = event.data; if(typeof(window[data.func]) == "function"){ window[data.func].call(null, data.params[0]); } } function alertMyMessage(msg){ alert(msg); }
function send(){ window.parent.window.postMessage( {'func':'alertMyMessage','params':['Thanks for Helping me']}, 'http://www.my-website.com' ); }