nathc100
asked on
Close popup window after server processing
Hi,
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 = window.open()
and then
MyWin.close()
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.
Cheers
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 = window.open()
and then
MyWin.close()
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.
Cheers
ASKER
Thanks bastibartel,
But didn't seem to work.
I ended up using RegisterStartupScript('Clo seUp') 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.
But didn't seem to work.
I ended up using RegisterStartupScript('Clo
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. )
<html>
<script type="text/javascript">
var MyWin;
function PopOn()
{ MyWin = window.open("./popup.html" , "WaitWindow", "width=200,height=100,left =100,top=2 00");}
function PopOff()
{ MyWin.close();}
</script>
<body>
<a href="main.html" onCLick="PopOn(); return false"> please pop up</a>
<br>
<a href="main.html" onCLick="PopOff(); return false"> please close</a>
</body>
</html>
Cheers,
Sebastian
The following works for me (on IE)
( needs a html document "./popup.html" which opens in popup window. )
<html>
<script type="text/javascript">
var MyWin;
function PopOn()
{ MyWin = window.open("./popup.html"
function PopOff()
{ MyWin.close();}
</script>
<body>
<a href="main.html" onCLick="PopOn(); return false"> please pop up</a>
<br>
<a href="main.html" onCLick="PopOff(); return false"> please close</a>
</body>
</html>
Cheers,
Sebastian
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Make sure that the variable is outside the function opening the window,
so that it is still know upon re-entry of the function.
<script>
var MyWin;
function OpenIt()
{
MyWin = window.open()
}
</script>