How can I call a Javascript function in an iframe from its parent?
Asked
Active
Viewed 6,256 times
0
-
2Is the iframe content on the same domain as the parent? – Rebecca Chernoff Nov 05 '10 at 23:42
-
1Possible duplicate: http://stackoverflow.com/questions/1600488/calling-javascript-function-in-iframe – Anderson Green Mar 19 '13 at 01:22
2 Answers
1
thejh, i just asked how TO call A function in AN iframe from its parent - "function in iframe", not "function in its parent". And you didn't even read the full question. Please do it next time.
By the way, the answer is as follows:
window.frames[0].doSomething(); // but be sure the iframe is loaded before calling its functions
fog
- 29
- 1
-
5"And you didn't even read the full question." You didn't provide a full question, let alone a complete sentence. :P – Amalgovinus Mar 23 '11 at 20:45
0
This took just half a minute of googling. And you didn't even write a full sentence. Please do it next time.
http://www.velocityreviews.com/forums/showpost.php?p=765140&postcount=2
(by the way, this only works if the domains are the same)
thejh
- 43,352
- 16
- 93
- 105
-
6
-
1The OP wants to call a function in the iframe from the parent. The link you posted is the opposite - calling a function in the parent from the iframe. – Ben Amada Dec 29 '12 at 21:48