Getting Value From Iframe To Iframe November 16, 2024 Post a Comment I have two iframes in the document movie.htm: and Solution 1: If both pages are in the same domain, you'll be able to iframe.contentDocument. https://developer.mozilla.org/en/XUL/iframe#p-contentDocumentSolution 2: postMessage. https://developer.mozilla.org/en/DOM/window.postMessagemovie.htm:<!DOCTYPE html><html><head></head><body> Current value:<divid="updatedvalue"></div><iframesrc="moviesearch.htm"></iframe></body><script>window.addEventListener ("message", function(e) { document.getElementById("updatedvalue").innerHTML = e.data; }, true); </script></html>Copymoviesearch.htm:<!DOCTYPE html><html><head></head><body><inputtype="text"onkeyup="sendMessage(this.value)"></body><script>functionsendMessage(message) { window.parent.postMessage(message, "*"); } </script></html>Copy Share Post a Comment for "Getting Value From Iframe To Iframe"
Post a Comment for "Getting Value From Iframe To Iframe"