I've seen this question (well, almost this question) asked a million times on web, but none of the solutions I've tried actually work...
I have a html document that has an iFrame inside of it.
Inside the iFrame web page, there is a javascript function.
iFrame HTML:
<html>
<script type="text/javascript">
function getElements(){var x=parent.document.getElementsByTagName("html")[0].innerHTML;alert(x);}
</script>
<body>blah blah blah</body>
<script type="text/javascript">getElements();</script>
</html>
I want to get the HTML code of the iFrame's parent. The JS function cannot exist in the parent. It has to exist in the child.
"x=document.getElementsByTagName("html")[0].innerHTML;" works just fine for showing the html text of the iFrame page itself, but obviously not for the iFrame's parent HTML page.
"x=parent.document.getElementsByTagName("html")[0].innerHTML;" does not seem to do anything. The alert never shows up. Both web pages are in the same folder, so there shouldn't be any security issues...
Ideas?
I have a html document that has an iFrame inside of it.
Inside the iFrame web page, there is a javascript function.
iFrame HTML:
<html>
<script type="text/javascript">
function getElements(){var x=parent.document.getElementsByTagName("html")[0].innerHTML;alert(x);}
</script>
<body>blah blah blah</body>
<script type="text/javascript">getElements();</script>
</html>
I want to get the HTML code of the iFrame's parent. The JS function cannot exist in the parent. It has to exist in the child.
"x=document.getElementsByTagName("html")[0].innerHTML;" works just fine for showing the html text of the iFrame page itself, but obviously not for the iFrame's parent HTML page.
"x=parent.document.getElementsByTagName("html")[0].innerHTML;" does not seem to do anything. The alert never shows up. Both web pages are in the same folder, so there shouldn't be any security issues...
Ideas?
Comment