0

There is an url www.example.com/page-1.php. This page has a function called make_circle. Used like this: make_circle('10');

When I visit www.example.com/page-2.php, I want it to run make_circle('10'); on www.example.com/page-1.php. Is this possible?


On www.example.com/page-2.php:

<iframe id="coolpage" src="www.example.com/page-1.php" style="width:100px;height:100px;border:0; border:none;"></iframe>
<!-- How do I run the make_circle function on page-1 while I am on page-2 -->
Kiwa
  • 215
  • 2
  • 10
  • https://stackoverflow.com/questions/1600488/calling-javascript-function-in-iframe – epascarello Feb 07 '19 at 00:08
  • I literally copied your questions title and got the result for https://stackoverflow.com/questions/251420/invoking-javascript-code-in-an-iframe-from-the-parent-page in google. – epascarello Feb 07 '19 at 00:09
  • @epascarello `document.getElementById('targetFrame').contentWindow.targetFunction();` What is the `targetFrame` id? is it the id in the iframe? In my case its called `coolpage` – Kiwa Feb 07 '19 at 00:13
  • @Kiwa: Yes. But how you get a reference to the iframe element doesn't matter. This is just an example. – Felix Kling Feb 07 '19 at 00:14

0 Answers0