Answers for "how to run iframe with html"

13

html iframe example

<iframe src="http://www.codegrepper.com"></iframe>
Posted by: Guest on June-26-2019
0

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();
});
Posted by: Guest on March-23-2022

Browse Popular Code Answers by Language