i have a page which has 4 frames the code is as below
<frameset id = framset_page rows="30,*" cols="*" border="0">
<frame name="topFrame" id="topFrame" noresize scrolling="NO" src="topFrame.jsp">
<frameset cols="200,50,*">
<frame src="FramesetLeftFrame.jsp" />
<frame src="middle.html" />
<frame src="FramesetRightFrame.jsp" />
</frameset>
</frameset>
the topFrame include a logout button.but what when i click the logout button,it just exit the topFrame others remain the same.how can i exit other frames either?writing code in the topFrame seems not work.thank you!
i have a page which has 4 frames the code is as below
<frameset id = framset_page rows="30,*" cols="*" border="0">
<frame name="topFrame" id="topFrame" noresize scrolling="NO" src="topFrame.jsp">
<frameset cols="200,50,*">
<frame src="FramesetLeftFrame.jsp" />
<frame src="middle.html" />
<frame src="FramesetRightFrame.jsp" />
</frameset>
</frameset>
the topFrame include a logout button.but what when i click the logout button,it just exit the topFrame others remain the same.how can i exit other frames either?writing code in the topFrame seems not work.thank you!
Share Improve this question asked Aug 12, 2010 at 6:28 huanglihuangli 4549 silver badges26 bronze badges3 Answers
Reset to default 5You can add target="_top"
to your link or you can use javascript to navigate using your top frame:
self.parent.location= "URL TO logout";
Examples:
<a href="logout.php" target="_top">Logout</a>
<a href="javascript://" onclick="self.parent.location='logout.php'">Logout</a>
Other alternative is, into your logged out page, add a 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>
This worked for me. By closing the top frame using the following code.
function logout() {
window.top.document.location ="../index.php";
}
this directs the page to the index page.
Please post the code for your logout button, form. However, if it is a form or a link/button, setting target="_top" might do what you're looking for.