Reputation: 7166
Is it possible to run functions from within the Iframe to the iframes OWN functions?
like
<iframe>
<script>
foo = function(){console.log('bar')};
foo();
</script>
</iframe>
Upvotes: 0
Views: 34
Reputation: 277
You may need an onload function:
This will fire a javascript function (preferably in your Head section) once the iFrame has fully loaded. (There are other ways to do this, but this keeps it simple).
Upvotes: 1
Reputation: 171679
No. The only time anything between the open and close tags of <iframe>
is compiled is if browser doesn't support iframes. Not likely many browsers like that around any more
If, and only if, the iframe url is on same domain as page you can communicate between the 2 windows with script depending on what it is you are trying to do
Upvotes: 0