Answers for "js pass data to iframe"

0

js pass data to iframe

window.addEventListener('message', function(event) {
    var origin = event.origin || event.originalEvent.origin; // For Chrome, the origin property is in the event.originalEvent object.
    if (origin !== /*the container's domain url*/)
        return;
    if (typeof event.data == 'object' && event.data.call=='sendValue') {
        // Do something with event.data.value;
    }
}, false);
Posted by: Guest on April-01-2021
0

js pass data to iframe

var frame = /*the iframe DOM object*/;
frame.contentWindow.postMessage({call:'sendValue', value: /*value*/}, /*frame domain url or '*'*/);
Posted by: Guest on April-01-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language