?
Solved

Close popup window after server processing

Posted on 2006-07-02
5
Medium Priority
?
199 Views
Last Modified: 2012-06-21
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
0
Comment
Question by:nathc100
[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
  • 2
5 Comments
 
LVL 5

Expert Comment

by:bastibartel
ID: 17052693
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.

<script>
var MyWin;

function OpenIt()
{
    MyWin = window.open()
}
</script>
0
 

Author Comment

by:nathc100
ID: 17096886
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.
0
 
LVL 5

Expert Comment

by:bastibartel
ID: 17097049
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=200");}

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
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 17125636
Closed, 250 points refunded.
Netminder
Site Admin
0

Featured Post

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

Question has a verified solution.

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

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
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 …
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

777 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