@ryleigh
To call JavaScript when a specific page is loaded into an iframe, you can use the following approach:
1
|
<iframe id="myFrame" src="page.html" onload="myFunction()"></iframe> |
1 2 3 4 5 6 7 8 9 10 |
function myFunction() { // Get the iframe element var iframe = document.getElementById("myFrame"); // Get the document of the iframe var iframeDoc = iframe.contentDocument || iframe.contentWindow.document; // Call the JavaScript function in the iframe document iframeDoc.myFunctionInIframe(); } |
1 2 3 |
function myFunctionInIframe() { alert('JavaScript function called in iframe!'); } |
By following these steps, you can call a JavaScript function in the iframe content when the specific page is loaded into the iframe.