确定网页是否在iframe中查看的最佳方法 [英] best way to determine whether a webpage is viewed in an iframe

查看:400
本文介绍了确定网页是否在iframe中查看的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以确定用户是在side和iframe中使用网页还是使用PHP正常浏览?

Is there a way to determine whether the user is using a web page in side and iframe or is it normal browsing using PHP?

推荐答案

使用上面@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.

这篇关于确定网页是否在iframe中查看的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆