Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

iframe set value on input outside js

var input = document.getElementById('input-field');

window.addEventListener('message', function(e) {
    // Check the origin, accept messages only if they are from YOUR site!
    if (/^http://www.mysite1.com/.test(e.origin)) {
        input.value = e.data; 
        // This will be 'Something something something'
    }
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #iframe #set #input #js
ADD COMMENT
Topic
Name
5+9 =