is it possible to prevent iframe content from escaping into main page using js?

天涯浪子 提交于 2020-01-05 04:17:15

问题


it is often done by code like this:

if ( window.parent.frames.length>0 )  {}  // check how many frames, if none do nothing
else {
   window.location="[new destination]";  // else change the current location
}

But I want to prevent iframe content from knowing that it is on the iframe. I am writing a php proxy and content will be from the same domain and I know that I have an option to remove instances of escaping code one by one using server side code but maybe is there an option to do it in js.


回答1:


The problem even has it's own wikipedia page http://en.wikipedia.org/wiki/Framekiller



来源:https://stackoverflow.com/questions/4002712/is-it-possible-to-prevent-iframe-content-from-escaping-into-main-page-using-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!