Closed Bug 451011 Opened 16 years ago Closed 14 years ago

window.close() should work with a warning message, for "registered" windows

Categories

(Firefox :: Tabbed Browser, defect)

x86
Windows Vista
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: sygram, Unassigned)

Details

(Whiteboard: [CLOSEME 2010-11-15])

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1

i have a standard form that people post some values. On the next page they see confirmation details. What i would like is to have a simple button that closes this page. Since they have an "x" button to close the form why not provide them a nice button that will close the current page ? It not logical for me that this is restricted since we are talking about a user event, not something automatic.

If you wish to secure this then it would be better to provide a nice alternative. i.e. register window from browser history (from the post form) and then be able to close. Otherwise how can i do it ? I can not call window.open as you realize to post values.

I appreciate your answers.

Regards

Akis

Reproducible: Always

Steps to Reproduce:
call window.close()
Actual Results:  
produces the message :

Warning: Scripts may not close windows that were not opened by script.

Expected Results:  
display a warning message and close the tab or window accordingly.
It's considered a harmful tendency, try to redesign your "web application". Thank your users for their time and let them do that extra click.
Thanks for your reply.

Actually i am trying to find out a way but consider that window.open might raise a pop up killer so the visitors will not be able to process the payment. They will have to allow the pop up from the warning message. In other words you lost the client. I think that having a simple post form should be the best practice in general.

Although displaying a message "thank you ... , you may now close this window" is not a bad idea i think this is not the way in 2008.

The issue sounds very simple. It is difficult to accept that the browser can not tell if the user has intentionally clicked on a form to move to this page. We are talking about closing only the current tab by clicking on a button...

Thanks again.

I look forward to your reply.

Regards,
Hi again,

If the window.open() originates from a click or submit event, then it's considered to be intended by the user.

I haven tried a few more events, such as unload, beforeunload, blur but they doesn't work. Suprisingly, focus does. But it shouldn't IMHO.

I also went to see how a few other big names do this, for example eBay + payPal , or CabalOnline + click&buy and AgeOfConan (an other MMO). And generally, they don't open a new window for the payment process, just use the current tab/window, and after the transaction is complete, they usually take you back to your profile.  

CabalOnline opens a new window via an ordinary A link, just uses a _blank target, and that's OK in XHTML 1 Transitional, but not in the Strict, however, this is just a minor difference.

What I've noticed, is not even a single payment processor opens a popup while you're using their site, they show confirmation on a separate page, and you can go back and forth by clicking Edit and then OK, and Edit and OK :)

Yeah, it's not really web2.x-ish to display a page that "You're free, your free will is now enabled, you can do whatever you want". But I'm sure you can think of a page where to send your costumers after they completed the process or use the click&buy solution and open a new window/tab/page via a simple A tag that also can be closed by window.close()


I appreciate your detailed reply.

People are visiting our pages from different channels, many times with different brandings so it is a bit difficult to send them back there they came from.

I still can not see Why this issue is strange/difficult to implement ... Why can i not close a tab from a url that i have already made a post ??? Why is this considered a security issue ? How can someone cause problem to my pc in this particular case ?
"Why can i not close a tab from a url that i have already made a post ???" - Excuse me, but I don't understand your question. What do you mean by "made a post"?

If you mean why can't you close a page that's opened directly by the user (via an explicit new tab/window command, from the menu, or via some other way, but the underlying method is the same), I think the answer is that, this way no script will close the last tab/window by accident. The MDC Wiki doesn't give more information than Firefox itself.

I think the behaviour of MSIE is a bit more developer friendly regarding this matter.

http://msdn.microsoft.com/en-us/library/ms536367(VS.85).aspx

Personally, I think that even if this bug/RequestForEnhancement get's some attention, it won't be implemented in a rush, because the accepted and widespread point of view is what I've already mentioned, that let the users close their tabs.
For long, it was possible for web developers to close windows with javascript, see bug 266371.
This is just very undesirable behavior from a user's perspective. Fwiw, I don't think adding a confirmation dialog for this, would be a good idea.
I understand that it is a long shot. 

By post i mean a form post. I as a user have clicked on a submit button ( same url ) so i moved from step 2 to step 3 on my wizard.

I have the impression that "Human interface design" indicates that as programmers we should try to minimize the distance of interface buttons e.g. if i can have a close button at the end of an article why would i have to look up again and find the tiny "x" button of the tab ?? The form that i am writing now has a "Commit" button right below this text field. Imagine if this button was at the start of the thread...

I general i think that it would be more user friendly. 

Regards 
This bug was reported using Firefox 3.0 or older, which is no longer supported. The bug has also not been changed in over 500 days and is still in UNCO.
Reporter, please retest this bug in Firefox 3.6.10 or later using a fresh profile, http://support.mozilla.com/en-US/kb/managing+profiles. If you still see this problem, please update the bug. If you no longer see the bug, please set the resolution to RESOLVED, WORKSFORME.

This is a mass search of unconfirmed bugs that have no activity on them, so if you feel a bug was marked in error, just remove the CLOSEME comment in the whiteboard within the next month.
Whiteboard: [CLOSEME 2010-11-15]
No reply, INCOMPLETE. Please retest with Firefox 3.6.12 or later and a new profile (http://support.mozilla.com/kb/Managing+profiles). If you continue to see this issue with the newest firefox and a new profile, then please comment on this bug.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.