|
|||||||
![]() |
|
|
Thread Tools | Search this Thread |
|
#1
|
|||
|
|||
|
I have server-side script that pops up after the user submits a form. It's basically telling the user if there's a problem with the data submitted or not.
the user is given a message, and presented with two buttons, "Go Back", which does an onClick="window.close()" And a "Next Step" which does onClick="window('http://...and the URL to the next page. Everything works OK, but when the user chooses to go to the next window, the one he was in stays open, unless he manually closes it. I tried using a dummy <INPUT TYPE="Image" src="transparent. gif" onBlur="window.close()"> and it didn't work. Probbly because there was no text area to gain focus, and hence focus to be lost. Does anybody have an idea on how to get un-needed pop-ups to close automatically, if the user leaves that window? Thanks. |
|
#2
|
||||
|
||||
|
Well, as you probably know, a window that wasn't opened by javascript cannot be reliably closed with javascript. If that isn't an issue here, any window opened by javascript can be made to close when it loses focus. I don't know if that will fit the situation you have, as your description is a little sketchy but, here's how - Just put a script like so in the head of the page:
Code:
<script type="text/javascript">
window.onblur=function(){self.close();};
</script>
__________________
WWWWWWWWWWWW - John________________________ Really Show Your Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate |
|
#3
|
|||
|
|||
|
Quote:
More often than not, I've encountered things like this in image galleries. Larger images open in pop-ups that I never asked for (bad enough in itself), and close automatically if they lose focus. As a dial-up user, I'm not about to sit around twiddling my thumbs waiting for an image to load. However, to not do so means that the image closes. I'm now either forced to wait, or (in Firefox) select View Image from the context menu and replace the pop-up contents (including that annoying code) with solely the image. There are, of course, other reasons why the window might lose focus. A background application might come to the foreground to indicate that it's finished or has encountered a problem. The operating system might do the same should a critical event occur. In any of these cases, it is not the user's intention to implicitly signal the end of a pop-up's use. In fact, they might not even have had time to read its contents. Modern operating systems are multitasking, and applications should be written with this fact in mind and behave themselves. By all means, close a pop-up in direct response to a user-initiated action, but don't try to guess what the user is doing. Ideally though, the OP would find a way to drop the pop-up entirely (at least if this is for the Web): one shouldn't assume that pop-ups will be accepted by the user. Mike |
|
#4
|
||||
|
||||
|
Quote:
I have and it hasn't been (a pain in the . . .) for me. However, I have a high speed connection. I've even written a gallery or so with exactly what you are talking about except that it is known to the user that clicking will retrieve the larger image so, it's not "not even asked for" and the 'larger image' isn't overwhelmingly large, about 8K. As for the OS or a BG ap interfering (which would interfere with even the simplest foreground task, web surfing aside), just open the pop up again. In support of my initial assertion that you raise some valid points: If this isn't practical for the OP, that would be the OP's job to decide. Your input certainly should help them in that decision making process as their pop up might not play well if it were to be dismissed inadvertently. However, this (close onblur) appears to be just what he/she was shooting for, albeit perhaps ill advised. The most important consideration here is probably - what if the user has pop ups blocked? In the case of the type of gallery I am talking about, where the focus of the site happens to be information and the gallery is just a side show to begin with, if you cannot access the big pictures in the photo gallery, you will just have to make due with the thumbs which are adequate for conveying the information. The larger images are just extra. But, if filling out a station in a series of forms that are critical for one reason or another, the pop up wouldn't be appropriate to begin with.
__________________
WWWWWWWWWWWW - John________________________ Really Show Your Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate |
|
#5
|
|||||
|
|||||
|
Quote:
![]() Quote:
Quote:
Quote:
Quote:
From the description supplied by the OP, the pop-up is created as a function of submitting a form. That implies that it is a one-time event. If so, closing the pop-up would be irreversible. Mike |
|
#6
|
||||
|
||||
|
Quote:
I think we agree on more of this than your most recent reply would at first make it appear. In any case, I think we agree on the above quote and my immediate comment after it. This is really the paramount consideration here. If the situation is otherwise, like if the form isn't so critical or it really isn't a form, etc. then there would probably be little harm but if, as we both suspect, it is an important form - then the OP shouldn't be using a pop up to begin with.
__________________
WWWWWWWWWWWW - John________________________ Really Show Your Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate |
|
#7
|
|||
|
|||
Thanks for the posts, folks! The discussion ranged a bit, but all the points made were valid; even those that didn't directly address the original issue.That's what's so neat about this place! Bob |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
|
|