I saw from this documentation: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage , a way to correctly pass data to an iframe. But now I want to send an answer:
//from main page myIframe.contentWindow.postMessage('send me a response', '*'); //from iframe of main page window.addEventListener("message", receiveMessage, false); function receiveMessage(event){ alert(event.data);//the value of message //now i need to send an answer 'this is a response' } }
How to send a response to the main page from iframe? I really need this answer.
Edit:
Ok, I found ty solution in general.
I would consider using easyXDM
EasyXDM WebSite
You have access to the parent window in the global window.parent.
window.parent
, , postMessage. - :
var parent = window.parent; parent.postMessage("some message");
.
- window.parent.postMessage() : otherWindow.postMessage(message, targetOrigin, [transfer]);
otherWindow.postMessage(message, targetOrigin, [transfer]);
Source: https://habr.com/ru/post/1678993/More articles:как распечатать всю HTML-страницу в формате A4 - htmlUsing a relative path in an executable with a symlink - c ++Как отключить Eureka и Spring Cloud Config в WebMvcTest? - spring-bootHow to enable C # 7 build in Team Foundation Server 2015? - c #Spring Cloud Service Unit Testing Strategy - springCan it be argued that Ada subtypes are equivalent to dependent types? - typesDjango shell mode in docker - pythonhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1678996/js-deprecation-synchronous-xmlhttprequest-on-the-main-thread-is-deprecated-because-of-its-detrimental-effects-to-the-end-users-experience&usg=ALkJrhjCz__caaI4VYwytIdcOL9Ehc_e9AExcerpt from list items with indices in another list - listReact-native fbsdk-based build errors - react-nativeAll Articles