[JavaScript] 防止页面被嵌入Iframe

页面验证未通过,需要跳转到Login页面,为防止Login页面被嵌入到IFrame中,需在Login页面的HTML源码的<body>与<form>之间加入如下代码,即可实现整个页面的跳转。

<body>
<script language="javascript" type="text/javascript">
if (top.location !== self.location)
{
      top.location=self.location;
}
</script>
<form id="form1" runat ="server">

页面跳转是使用如下:
Response.Write("<script>top.location.href='../../logout.aspx';self.close();</script>");

posted @ 2008-02-26 13:50  Angelo Dell'inferno  阅读(1136)  评论(0编辑  收藏  举报