Forum Moderators: open
Apologies in advance for being a novice amongst the throng but my head's hurting....from thinking and banging against a wall!
I've got this code and all I want to do is be able to view the HTML of a remote site:
This is "index.html":
<html>
<frameset rows="50%,50%">
<frame>
<frameset cols="25%,75%">
<frame src="alertsource.html" name="frame1">
<frame src="http://www.anywebsite.com" name="frame2"></frame>
</frameset>
</frameset>
</html>
This is "alertsource.html":
<html>
<head>
<script type="text/javascript">
function alertsource()
{
sData = parent.frame2.document.documentElement.innerHTML;
alert(sData);
}
</script>
</head>
<body>
<form>
<a href=javascript:alertsource()>ALERTSOURCE</a>
</form>
</body>
</html>
I've got as far as understanding that Javascript incorporates "Same Origin Policy" which I assume prevents the code working - (when "http://www.anywebsite.com" links instead to a local file such as "file://C:\anylocalwebpage.html" the code works fine).
I do not want to access a remote website's html for malicious purpose, but just to use the html in the links to dynamically update the links on my webpage.
Does anyone know of a workaround? If Explorer is able to show the full DOM in the browser's View Source window then surely you can access the content using script? I've explored some remote PHP sites with special source scripts but they show a small extract of the html source.
Please Help!