开发者

Scripted iFrame loads contents over current page instead of within an iFrame

开发者 https://www.devze.com 2022-12-25 18:03 出处:网络
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'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 开发者_如何学Gochecks 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?


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">

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

0

精彩评论

暂无评论...
验证码 换一张
取 消