开发者

Frame busting but not if it's me

We've partenered with another website and want to display their website in an iframe on our website.

They want to implement frame busting javascript on their site so that if anyone other than us tries to frame their site then their site will bust out of the frame.

Right now, they're using code like this:

<style> 
html{display : none ; } 
</style> 
<script> 
if( self == top ) 
{ document.documentElement.style.display = 'block' ; }
开发者_如何转开发else 
{ top.location = self.location ; } 
</script> 

How can they ensure that when our site is the container frame, that the frame-busting does not occur?

Thanks for any help!

Peter


They could check the value of top.location in that "else" clause, and if it contains your domain name, they could skip busting out. It's not like it's secure or anything, but it's doubtful anyone would be interested in fooling it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜