Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

run javascript in iframe

let script=document.createElement('script');
script.innerText=`your script`
document.querySelector('iframe').appendChild(script)
Comment

run javascript in iframe

var iframe = document.getElementById('frameID'),
    iframeWin = iframe.contentWindow || iframe,
    iframeDoc = iframe.contentDocument || iframeWin.document;

window.hello = function () {
    alert('hello from owner!');
};

$(iframeDoc).ready(function (event) {
    iframeDoc.open();
    iframeDoc.write('iframe here');
    iframeDoc.write('<script>alert("hello from iframe!");</script>');
    iframeDoc.write('<script>parent.hello();</script>');
    iframeDoc.close();
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: mysql json 
Javascript :: javascript how to open a file 
Javascript :: js add element to array 
Javascript :: how can hide link from inspect element 
Javascript :: Sum of Digits / Digital Root 
Javascript :: creatable select react 
Javascript :: js format date 
Javascript :: p5.js typescript 
Javascript :: javascript unique array 
Javascript :: jquery add 
Javascript :: learn nodejs 
Javascript :: how to turn decimales into percents with javascript 
Javascript :: confluent kafka nodejs 
Javascript :: reset value object js 
Javascript :: react emoji picker 
Javascript :: evento tecla enter javascript 
Javascript :: copy object with new property in js 
Javascript :: react router path array 
Javascript :: datatable on change event jquery 
Javascript :: console.log() Print a Sentence 
Javascript :: jquery add attribute without value 
Javascript :: cek versi node js 
Javascript :: sort array of numbers 
Javascript :: Expected an identifier and instead saw ' 
Javascript :: queryselectors select element whole class 
Javascript :: pdf.js extract text 
Javascript :: save file javascript 
Javascript :: material icon button angular 
Javascript :: angular local storage ionic 
Javascript :: save previousdata react 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =