Getting Value From Iframe To Iframe May 26, 2023 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-contentDocument Solution 2: postMessage. https://developer.mozilla.org/en/DOM/window.postMessage movie.htm: <!DOCTYPE html> <html> <head> </head> <body> Current value:<div id="updatedvalue"></div> <iframe src="moviesearch.htm"></iframe> </body> <script> window.addEventListener ("message", function(e) { document.getElementById("updatedvalue").innerHTML = e.data; }, true); </script> </html> Copy moviesearch.htm: <!DOCTYPE html> <html> <head> </head> <body> <input type="text" onkeyup="sendMessage(this.value)"> </body> <script> function sendMessage(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"