Javascript 是否可以使用JS防止iframe内容转义到主页?

Javascript 是否可以使用JS防止iframe内容转义到主页?,javascript,html,iframe,Javascript,Html,Iframe,它通常由以下代码完成: if ( window.parent.frames.length>0 ) {} // check how many frames, if none do nothing else { window.location="[new destination]"; // else change the current location } 但是我想防止iframe内容知道它在iframe上。 我正在编写一个php代理,内容将来自同一个域,我知道我可以选择使用服

它通常由以下代码完成:

if ( window.parent.frames.length>0 )  {}  // check how many frames, if none do nothing
else {
   window.location="[new destination]";  // else change the current location
}
但是我想防止iframe内容知道它在iframe上。 我正在编写一个php代理,内容将来自同一个域,我知道我可以选择使用服务器端代码逐个删除转义代码的实例,但也许可以在JS中执行