views:

113

answers:

1

I'm trying to load a webpage into an iFrame while keeping a content bar on top, but for some pages that I try to load into the iFrame the contents is loaded as if I navigated to that page.

I use the following code to dynamically load an iframe:

$('#my_iFrame').attr("src","http://www.nytimes.com/2010/03/26/opinion/26ryan.html");

It looks like there is a script on these pages that checks to see if it is being loaded into an iframe and changes the document.location to it's own url if so.

Is there any way around a hack like this so that I can load that site into an iFrame? Maybe some way to protect the value of window.location?

A: 

By Googling, I found this:

<script>
function StopLoading()
{
if (!document.all)
{
window.stop();
}
else
{
window.document.execCommand('Stop');
}
}
</script>

<iframe onload="StopLoading()" src="http://www.someaddress.com"&gt;

However, it seems it does not work if it is in a different domain. can you try it for a page on same domain and a different domain?

source: http://www.steadyhealth.com/Web_Hosting_Anti_Frame_Breaker_solution_t53346.html

SHiNKiROU