@jerad
You can achieve this by using the postMessage() method in JavaScript. Here's how you can do it:
1
|
var childIframe = document.getElementById('child-iframe').contentWindow;
|
1 2 |
var message = { key: 'value' };
childIframe.postMessage(message, 'http://child-iframe-origin.com');
|
1 2 3 4 |
window.addEventListener('message', function(event) {
var data = event.data;
console.log(data.key); // 'value'
});
|
By following these steps, you can easily post variables from the parent iframe to the child iframe.