Close popup window after server processing


I have a webpage(.aspx) where users can upload images.
I am using javascript to pop up a clientside window(saying "Please wait") when the user clicks on "Upload".
This upload button also triggers a postback to the server so image type checking can be performed and the image uploaded.
My problem is once the server is done processing the image and returns the .aspx page to the user how can I close the "Please wait" window?

I have seen similar posts suggesting this method:

MyWin =

and then


The opening bit works but then if I put the close bit in the page load handler of the .aspx page it doesn't work.
Does the javascript variable persist through postbacks? I don't know javascript at all.

Who is Participating?
NetminderConnect With a Mentor Commented:
Closed, 250 points refunded.
Site Admin
Hi there,

Make sure that the variable is outside the function opening the window,
so that it is still know upon re-entry of the function.

var MyWin;

function OpenIt()
    MyWin =
nathc100Author Commented:
Thanks bastibartel,

But didn't seem to work.

I ended up using RegisterStartupScript('CloseUp') in my code behind to call the javascript procedure.
And then in CloseUp() I did something like window.Open('',popup) then popup.close
Syntax is not correct just remembering off the top of my head.
Hi nathc100

The following works for me (on IE)
( needs a html document "./popup.html" which opens in popup window. )

<script type="text/javascript">
var MyWin;
function PopOn()
{   MyWin ="./popup.html", "WaitWindow", "width=200,height=100,left=100,top=200");}

function PopOff()
{  MyWin.close();}

<a href="main.html" onCLick="PopOn(); return false"> please pop up</a>
<a href="main.html" onCLick="PopOff(); return false"> please close</a>

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.