I need to call a function which is in iFrame from developer console. But I'm unable to do that.
I tried the following and I get a error that its not a function.
document.getElementById('firstWindow').contentWindow.document.myFunction()
window.frame["firstWindow"].myFunction()
The scritp is inside
document.getElementById('firstWindow').contentWindow.document
. But how do I call it?
Here is how the code looks like:
<html>
<body>
<--- Content from iFrame -->
<iframe id="firstWindow" name="firstWindow" src="/test">
<html>
<head>
<script>
myFunction(){
console.log('test');
};
</script>
</head>
<body>
some text
</body>
</html>
</iframe>
</body>
</html>