---
title: "Session失效，从IFRAME跳转到别的页面问题"
author: "tk_zhang"
date: "2011-10-22T17:29:26Z"
tags: ["HTML", "JS", "session"]
categories: ["Web前端"]
slug: "session-iframe"
draft: false
lastmod: "2011-10-22T17:30:38Z"
id: 1207797
url: "https://tk-zhang.iteye.com/blog/1207797"
---

Session失效，我们需要跳转到登陆界面，可是如果是IFRAME的话，可能就直接在IFRAME里面跳转了，这不是我们想要的结果，其实我们只要加上下面这段代码，就可以跳转到一个全新的页面，代码如下：

 

```
<script type="text/javascript">
		if(top != self) {
			if(top.location != self.location) {
				top.location = self.location;
			}
		}
</script>
```