?
Solved

logout of a session

Posted on 2003-03-17
12
Medium Priority
?
12,842 Views
Last Modified: 2012-06-27
I am deveoping a s/w in jsp where I use two frames. The left frame shows all the options and the corresponding forms are shown in right frame.I have a option for logout. The code I have given is
<A HREF="javascript:self.close()">Logout</a><BR>

I also tried out the following code:
<script>
function clos()
{
     window.close();
     window.open("index.html","_blank");
}
</script>
<A HREF="javascript:clos()">Logout</a><BR>

The index.html file opens in a new window but the old window is not closed.

Please help me out so that I can show index.html(which shows the login screen) without frames in the same window and thus logout of the current session
0
Comment
Question by:kishore_varier
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
12 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 8151499
try this:

function clos()
{
    window.open("index.html","_blank");
    setTimeout('self.close()',500);
}
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 8151501
and do this in the link:

<A HREF="Close" onclick="close();return false;">Logout</a><BR>
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 8151510
actually, you may want to do this in the setTimeout:

function clos()
{
   window.open("index.html","_blank");
   setTimeout('self.opener=null;self.close()',500);
}


and I mis-typed in the link onclick:  use "clos" instead of "close"
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 1

Author Comment

by:kishore_varier
ID: 8151597
hi knightEknight,

I tried out both your options.

The second window opens up with index.html but the first window does not close.I use IE 6.0 and win2000 server

thanks
kishore
0
 
LVL 1

Author Comment

by:kishore_varier
ID: 8152851
This is the code generated from my jsp, since I give the options based on the type of user. So i have to generate code dynamically

<HTML>
<TITLE>Welcome</TITLE>
<BODY bgcolor="#e2e0c0">
<A HREF="incoming.jsp?userid=Admin" target="main">Incoming Box</a><BR>
<A HREF="in.jsp?userid=Admin" target="main">Inbox</a><BR>
<A HREF="out.jsp?userid=Admin" target="main">Outbox</a><BR>
<A HREF="createuser.html" target="main">Create User</a><BR>
<A HREF="edituser.jsp?userid=Admin" target="main">Edit User Details</a><BR>
<A HREF="changepwd.jsp?userid=Admin" target="main">Change Password</a><BR>
<A HREF="createdoc.html" target="main">Create Document</a><BR>
<A HREF="createorgunit.html" target="main">Create Organizational Unit</a> <br>
<A HREF="doctype.html" target="main">Create/Edit Document Type</a><BR>
<A HREF="workflow.html" target="main">Create/Edit WorkFlow</a><BR>
<A HREF="history.html" target="main">View Document History</a><BR>
<A HREF="report.html" target="main">Generate Reports</a><BR>
<A HREF="javascript:window.close();">Logout</a><BR>
</BODY>
</HTML>
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 8153546
Try this:

<A HREF="Close"  onclick="self.opener=null;self.close();return false;">Logout</a><BR>
0
 
LVL 33

Accepted Solution

by:
knightEknight earned 100 total points
ID: 8153559
why do you set target="main" ?  Do you have a frameset?

If so, then use this instead:

<A HREF="Close"  onclick="top.opener=null;top.close();return false;">Logout</a><BR>
0
 
LVL 1

Author Comment

by:kishore_varier
ID: 8163986
thanks knightEknight.....

I had mentioned that I used frames in the beginning itself.
Just one more doubt.

function clos()
{
  window.open("index.html","_blank");
}
<A HREF="Close" onclick="clos();top.opener=null;top.close();return false;">Logout</a><BR>

The above code was used by me and the old window closes and the new window opens with index.html.

How can I maximize the second window since when it opens the index.html file it opens it in small window and hence we can make out that a new window is popped up?Instead if we could make the user feel as if it is in the same window it would be wonderful.
0
 
LVL 1

Author Comment

by:kishore_varier
ID: 8164111
I have given you the points.
But still if you have an answer to my final question I would be happier.

Thanks a lot
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 8166506
You can set the width and height of the new window like this:

window.open("index.html","_blank","width=500,height=600");


You can also set the starting X,Y position of the window, but you would want to set them to the X,Y of the old window.  A lot of work for not much gained.
0
 
LVL 1

Author Comment

by:kishore_varier
ID: 8167797
Sorry knight but I dont have a lot of points right now.....but anyway thanks for the trouble you took.
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 8168391
thanks for the A  :)
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question