检测这是iframe加载还是直接加载 [英] Detecting if this is an iframe load or direct
本文介绍了检测这是iframe加载还是直接加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望只显示一个表单,如果它被拉到iframe中的页面上。我怎么做?是否有服务器端解决方案?
I am looking to only show a form if it is pulled on a page within an iframe. How do I do that? Is there a server side solution?
推荐答案
如果您使用的是JQuery ...(此处的安装说明: http://jquery.com/ )
If you are using JQuery... (installation instructions here: http://jquery.com/ )
$(document).ready(function(){
if( window == window.top) { $('form#myform').hide(); }
});
如果窗口不是最顶层的窗口,则只隐藏带有myform的表单。
Which just hides the form with id "myform" if the window is not the topmost window.
这篇关于检测这是iframe加载还是直接加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文