?
Solved

Browser Refresh After Window Close

Posted on 2003-02-28
6
Medium Priority
?
386 Views
Last Modified: 2008-02-01
I have a frameset with a top and bottom menu.

i have a link in the top menu called "Member Login" which when clicked opens a new window with the login script.

What i would like to do is that when the user logs in and that the self.close(); function is invoked in the login script (I.E.: when the login window closes) that the main browser (the frameset with the top menu and bottom "main" frame) would refresh. but only when the login window closes... not before...

is that possible? and how?

here is my function to open the new window:

<script language="JavaScript">
<!--
function LoginRefresh()
{
  window.open("Login%20Form.asp");
  document.location.reload(true);
}
//-->
</script>

which is being called by this link:

<table border="0" cellpadding="0" cellspacing="0" width="100%">
     <tr>
          <td width="30%"><font face="Comic Sans MS" color="#408080" size="1"><a href="cgi-bin/agenda_minutes/frame.asp?Subject=1" target="middle">Agendas/Decisions</a></font></td>
          <td width="30%"><font face="Comic Sans MS" color="#408080" size="1"><a href="Report_menu.asp" target="top1">Change Reports/Logs</a></font></td>
     ----->>><td width="30%"><font face="Comic Sans MS" color="#408080" size="1"><a href="" OnClick="LoginRefresh()">Member login</a></font></td><-----
          <td width="10%"><font face="Comic Sans MS" color="#408080" size="1"><a href="mailto:extott.sxpm-signet-o@dfait-maeci.gc.ca">Contact Us</a></font></td>
     </tr>

Thanks!

MaxOvrdrv2
0
Comment
Question by:MaxOvrdrv2
[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
  • 3
  • 2
6 Comments
 
LVL 10

Author Comment

by:MaxOvrdrv2
ID: 8042941
and this and any other methods for refreshing the browser so far has only opened a new window on top of the login script window and does not wait for the login window to close before refreshing...

MaxOvrdrv2
0
 
LVL 7

Expert Comment

by:cubrovic
ID: 8043372
You can try this

function LoginRefresh()
{
 var ww = window.open("Login%20Form.asp");
 ww.opener = ww
}


and in the "login form.asp"


function ReloadMain() {
 window.opener.document.location.reload(true);
}



<body onunload="ReloadMain()">
0
 
LVL 10

Author Comment

by:MaxOvrdrv2
ID: 8043797
it doesn't work... it still just refreshed the new window and not the main one...

Login Handler that pops-up in new window:

<!--#INCLUDE FILE="ssifiles/Constants.inc"-->
<!--#INCLUDE FILE="ssifiles/loglib.inc"-->
<!--#INCLUDE FILE="ssifiles/TestAuthenticateLib.inc"-->
<!--#INCLUDE FILE="ssifiles/ManageActionItem.inc"-->
<html>

<head>
<title>Login credential validation script</title>
<!--#INCLUDE FILE="MyCSS.inc"-->
</head>

<body onunload="ReloadMain()">
<%
ProcessLoginRequest
%>
</body>
</html>

Authentication that logs in the user (some portions are blacked out for security reasons but have nothing to do with the task...):


<%
'The procedure 'ProcessLoginRequest' validates the login request passed in the login form against the information contained in
'the user table.

Sub ProcessLoginRequest()

Dim SIGNET_O_User(6)
Dim SQLString, strSQL

--PORTION BLACKED OUT FOR SECURITY REASONS--


'Run the query against the database
MyRecordset.CursorType = 3

--BLACKOUT--

If MyRecordset.Recordcount = 0 Then
     Response.Write "Sorry but the UserId you provided is not a known SIGNET-O member."
     Response.Write "  <a HREF='../login form.asp'>Try again</a>..."
     --BLACKOUT--

ElseIf MyRecordset.Recordcount > 1 Then
     Response.Write "<p>Sorry but there seem to be multiple matches for the UserId you provided.<br>"
     Response.Write "Please contact the site administrator.</p>"
     --BLACKOUT--

Else
     If MyRecordset("IsActive") = False Then
          Response.Write "Sorry but the UserId you provided is no longer an active SIGNET-O member.  Contact the SIGNET-O coordinator to ask for the account to be reactivated."
          --BLACKOUT--


     ElseIf Request.Form("Password") = MyRecordset("Password") Then
          Response.Write "Hi " & MyRecordset("First Name") & ".  You are logged on.  Click <a href='../default.htm' target='_top'>here</a> to see the site with full menu or refresh the screen you initiated this login from.<br><br>"
          Call CloseWindow()
         

     Else
          Response.Write "Sorry but the password you provided is not the right one.."
          Response.Write "  <a HREF='../login form.asp'>Try again</a>..."
          --BLACKOUT--
     End If
 
  'Modify the session timeout value
  Session.Timeout = 60

End If

--BLACKOUT--
End Sub








%>
<script language="JavaScript">
<!--
function CloseWindow()
{
self.close();
}
//-->
</script>
<script language="JavaScript">
<!--
function ReloadMain()
{
window.opener.document.location.reload(true);
}
//-->
</script>


i keep getting this error:


Microsoft VBScript runtime error '800a000d'

Type mismatch: 'CloseWindow'

/signet_o/cgi-bin/ssifiles/TestAuthenticateLib.inc, line 41

it's very weird...

MaxOvrdrv2
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 
LVL 7

Accepted Solution

by:
cubrovic earned 400 total points
ID: 8044184
Your pronblem is in asp code

Microsoft VBScript runtime error '800a000d'

It's trying to execute your client code on the server ?!
Try moving client script into the head section of the html documen (where it should be anyway)

0
 
LVL 1

Expert Comment

by:spiritwithin
ID: 8046311
Why not just go ...

<body onunload="window.opener.top.subFrameName.location.reload();">

... in the popup window code? Note that subFrameName should be the name of the subframe in the main window (the one you want to refresh).

Don't know about ASP. So i thought why not post that, maybe it is no serverside problem.

Cheers.
0
 
LVL 10

Author Comment

by:MaxOvrdrv2
ID: 8058922
the answer you gave was not exactly what i wanted but with the help of your code... i was able to get it working... here's how i got it to work...

what i did was that whenever someone clicks on the "Member Login" button, it calls the GetURL() function and that function takes care of everything... from getting the URL to loading the Login Form with the bottom frame URL in a query string...

then from there... if the user is logged in properly... it redirects him/her to the previous page that is contained in the querystring:

<script language="JavaScript">
<!--
function GetURL()
{
 TheString=""
 TheString="http://sxpmsrv/signet_o/TestLogin%20Form.asp?TheUrl=" + window.parent.frames.middle.location.href;
 
 window.parent.frames.middle.location.href=TheString;
 window.parent.frames.middle.Reload();
 return;
}
//-->

thanks for your help everyone...

MaxOvrdrv2
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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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

762 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