I tried this code: document.getElementById('targetFrame').contentWindow.targetFunction();
from here but it seems like you have to put it outside of the iframe. How can you do it only in the iframe and not anything outside of it?
Asked
Active
Viewed 42 times
-2

Shawn-Explorer
- 3
- 1
1 Answers
0
You can't.
The only way a code in a frame can communicate with parent page and vice versa, is via postMessage()

vanowm
- 9,466
- 2
- 21
- 37