且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

确定网页是否在iframe中查看的***方法

更新时间:2023-11-28 18:55:40

使用上面@deceze提到的javascript代码(我将其粘贴在下面),

Using the javascript code that @deceze mentioned above (I pasted it in below),

if (parent.frames.length > 0) { ... }

如果以上代码注意到该页面显示在iframe中,则通过ajax调用调用"IAmInIFRAME.php"(仅作为示例).

If the above code noticed the page was displayed within iframe, then call 'IAmInIFRAME.php'(just example) via ajax call.