Logout from current jsp page to login page

I have a problem. I used a jsp page that contains several frames. One of these frames has an exit button. If I log out, only this part changes, not the entire page (since the frame is just a view). So the question is, how can I make the entire jsp page (one of which contains several frames) to go back to the login page?

+4
source share
1 answer

What you can do is add target="_top" to your link or use javascript to navigate your top frame:

 self.parent.location= "Logout URL"; 

Take a look at this for reference:

 <a href="log_me_out.jsp" target="_top">LINK</a> <a href="javascript://" onclick="self.parent.location='log_me_out.jsp'">LINK</a> 

Or else, what you can do is go to the remote page, add javascript code to remove the frames redirecting your document to the top frame:

 <script type="text/javascript"> if (self.parent.frames.length != 0){ self.parent.location=document.location.href; } </script> 
+4
source

Source: https://habr.com/ru/post/1387683/


All Articles