Refresh a window that is already open from another window

My website is designed using Coldfusion and has 2 places where a user can login:

1.) From my main index page - simple form with username & password text boxes
2.) My Contact Us page - A link (shown below),  from my main index page opens a NAMED window, also with a form with username & password text boxes

<a href="#" onclick="'CEmailus.cfm?visitor=yes','EmailManager','width=600,height=600,scrollbars=yes,resizable=yes,status=yes');return false;" target="_blank">Contact Us</a>

WHAT I AM TRYING TO DO REFERS TO THE 2nd OPTION ABOVE:  If the user chooses to login from the pop-up window, then I need the original window refreshed and logged in as well.

When a user logs in from either of the forms, the username & password variables are passed through a page called "loginauthentication.cfm" and then upon sucessfully validating the variables, they are redirected to the correct page using "CFLOCATION URL=" xxx ".

TO SUM UP:  If a user logs in from the main index page sucessfully, they are redirected to their MAINPAGE and everthing is good.  If they log in sucessfully from the pop-up window,  they are redirected back to the Contact Us MAINPAGE in the pop-up window . . . . I need to take it one step further and have the main index page to be refreshed when the Contact Us MAINPAGE opens so that the MAINPAGE is also logged in.

TRIED: using "onload ='window.location.replace'(URL)" variations within the pop-up window's body tag, but I don't know how to target this to my main index page - I don't know how to refer to it by name and not sure how to use TARGET with window.location.replace.

Any help would be greatly appreciated.

Who is Participating?
Pravin AsarPrincipal Systems EngineerCommented:
<title>Open/Close Windows</title>
<script language="javascript">
alert ('Loading ..');
This is a test page.
<br>1. Click on "Open Window."
<br>This opens same document on new window.
<br>2. Click on "Open Window" in newly window.
<br>This opens same document on another window.
<input type="button" value="Open Window" onClick=" (window.location.href, 'nw',  'width=400, height=400');">
<input type="button" value="Refresh Parent Window" onClick=" window.opener.reload(true);">
Pravin AsarPrincipal Systems EngineerCommented:
You problem seem to check if user has logged in ?

Since you mentioned about cfm, are you managing cf session ? Setting cf session variables
(session.username, session.password, ...)  ?

In such case in application.cfm you can have a check,

To get the parent window of pop up window and reload by force (overriding the cache-control),
you can do

window.opener.reload (true);
MaxwellTurnerAuthor Commented:
Hi, thanks for the replies.  Although I've been working with Coldfusion for a number of years, I am not very familiar cf sessions and application.cfm - I know they exist but that is about all.  I use cookies to set the user's variables when they log in.

I'm not sure if I explained my problem properly.  I don't want to have to click any button, but rather need this to happen automatically.  Basically, if the user logs in from the CONTACT US page (the small pop-up window that opens from a link on the INDEX page), all I need is for the INDEX page, behind the CONTACT US pop-up, to be refreshed with the following URL:


1.)  User goes to my website - the first page they see is INDEX.cfm
2.)  User clicks the CONTACT US link to open the pop-up window
3.)  User enters their USERNAME & PASSWORD in the login boxes on the CONTACT US pop-up and submits them
4.)  Upon sucessfully validating their login variables, the CONTACT US page is refreshed showing their name/address etc.. they are now logged in, but only on the CONTACT US pop-up and not on the INDEX page.  If they close the CONTACT US pop-up, they will again need to log into the INDEX page if they want back in.
5.)  As #4 above occurs, I need "cmainpage.cfm?view=#view#" to be sent to the INDEX.cfm page which will log them in there as well, so that if they close the CONTACT US pop-up, they will still be logged into the site.

As I already mentioned earlier, I have tried to use:

<body onload="window.location.replace('Cmainpage.cfm?view=#view#')"> on the CONTACT US pop-up, but I do not know how to TARGET this to the INDEX page.  The above "onload" code is only executed after sucessful login from the CONTACT US page.

Well, I'm not sure if I explained it much better.  Perhaps if you go to the site it will make more sense.

The site we are talking about here is at and you can use:

USERNAME:  samreg
PASSWORD: company
. . . to try log in.

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Pravin AsarPrincipal Systems EngineerCommented:
Target or parent window of CONTACT US window, ( I as posted earlier )  is : window.opener

In you case it will be :


MaxwellTurnerAuthor Commented:
My apologies - you are correct and it works perfectly!!  I just put the above line in an OnLoad= statement and it does exactly what I was try to accomplish.  So very simple!

Thank you very much for your help . . . . and patience;)

Pravin AsarPrincipal Systems EngineerCommented:
You are welcome!


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.