登录信息失效,登录界面显示在frame中,在登录界面添加
<script type="text/javascript">
if (top.location != self.location) {
alert('登录信息失效,请重新登录!');
top.location = self.location;
}
</script>
-
if (top.location == self.location) 判断当前location 是否为顶层 来禁止frame引用
-
top表示主窗口,location表示当前窗口,如果你的文件只有一个框架,没有iframe和frameset,那么是完全一致的,没有区别。
-
top.location是在顶层frame中打开新页
-
window.location是在当前frame中打开新页
-
parent.location 在当前窗口的父窗口打开Url地址