现在的位置: 首页 > 综合 > 正文

网站的退出问题!

2013年09月08日 ⁄ 综合 ⁄ 共 1607字 ⁄ 字号 评论关闭

http://www.javaeye.com/topic/145818

 

 

用户登陆的校验是放到一个servlet里面的,项目用到frame,所以地址栏的地址一直是这个servlet的地址。当点击退出以后,我把程序转向登
陆页。但是地址栏是没有变化的,在次刷新又进去系统了。这个问题我实在不清楚应该怎么弄了,我想改变地址栏的地址,http://localhost:
8080/webGUI/forwardCnm

但是无论是转发,重定向,还是js的location地址栏始终没有变化。就在这个地址栏上刷新还能得到用户名和密码。实在是搞不清楚怎么回事了,望有精验的前辈给个解决方案!

 

 

 

发表时间:2007-12-11

window.location.href

改成

window.parent.location.href

0
发表时间:2007-12-11

codeutil 的几句话让我解决了这个一直想不通的问题。谢谢!

按这个解决方法,可以想像成jsp的include就好比dom里面另加一个窗口吧。

0
发表时间:2007-12-22

codeutil的方法是正解。

引用自:

http://www.howtocreate.co.uk/tutorials/javascript/browserinspecific

引用

If the page is the only page being displayed, top, parent, self and
window will be equal. If the page is being held within a frameset, self
and top will not be equal. If the page is the page containing the
frameset, and it itself is not being held within a frameset, self and
top will be equal. If someone is loading your page into their frameset
and you don't want them to, you can use the self-top relationship to
remove your page from their frameset and replace their frameset page
with your page using:

Java代码
  1. if
    ( self != top ) { top.location.replace(self.location.href); }  

Note, I could have used this:

Java代码
  1. if
    ( self != top ) { top.location.href = self.location.href; }  

However, that makes the browser add the new entry into its history,
so if they clicked their back button, they would be forwarded back to
your page again. Unfortunately, Gecko browsers
(Mozilla/Firefox/Netscape 6+) will only allow the second option as they
have very high security levels relating to cross-site scripts.

 

 

抱歉!评论已关闭.