Closed Bug 239295 Opened 22 years ago Closed 20 years ago

onClick="return XXX" doesn't halt next page from being loaded.

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED EXPIRED

People

(Reporter: seven, Unassigned)

References

()

Details

User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.6) Gecko/20040206 Firefox/0.8 Build Identifier: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.6) Gecko/20040206 Firefox/0.8 Some webpages and webmail-scripts, forums, etc. the creators use a construction with onClick="return XXX" to ask for a confirmation. In Mozilla FireFox 0.8 the browser doesn't wait continuing to load the next page before feedback is given, so even if the javascript returns False, it still continues posting the info. The only way to work around this is using a popup with a confirmation, which submits the confirmation(very dirty PHP-stuff, looks hidious with Tabbrowser extension and such). Example: <script language="javascript"> function ConfirmDrop() { temp=confirm('Are you sure you want do this?'); return temp; }</script> <form method=post action=browse.php name=drop> <input type=submit name=submit value="Submit!" onclick="return ConfirmDrop()"></form> Reproducible: Always Steps to Reproduce: 1. Find a webpage which uses onClick to ask for a confirmation, or copy-paste the above given example into a textfile(and save it as HTML) 2. Open this page in Mozilla Firefox and press the submit button. Wait for confirming, and you'll see the next page is already loaded. Actual Results: Page loaded without waiting for confirmation Expected Results: wait for confirmation, for backwards-compatibility(IE :[ ), or discourage to use this construction(onSubmit in the <form> sounds more logical for this)
it should be handled onSubmit, onClick is wrong, and handling things the way IE handles them breaks w3c DOM in a lot of places. moving for duping/invalidation.
Assignee: firefox → events
Component: General → Event Handling
Product: Firefox → Browser
QA Contact: ian
Version: unspecified → Trunk
I'm getting this too on <a href="#" onclick="return false"> (see testcase at http://recht.aub.auc.dk/test.html) - when clicking the link, the page is loaded even though onclick returns false. This used in a lot of places to create popup windows while at the same time keeping compatibility with clients which have js turned off, so it's pretty annoying.
This is an automated message, with ID "auto-resolve01". This bug has had no comments for a long time. Statistically, we have found that bug reports that have not been confirmed by a second user after three months are highly unlikely to be the source of a fix to the code. While your input is very important to us, our resources are limited and so we are asking for your help in focussing our efforts. If you can still reproduce this problem in the latest version of the product (see below for how to obtain a copy) or, for feature requests, if it's not present in the latest version and you still believe we should implement it, please visit the URL of this bug (given at the top of this mail) and add a comment to that effect, giving more reproduction information if you have it. If it is not a problem any longer, you need take no action. If this bug is not changed in any way in the next two weeks, it will be automatically resolved. Thank you for your help in this matter. The latest beta releases can be obtained from: Firefox: http://www.mozilla.org/projects/firefox/ Thunderbird: http://www.mozilla.org/products/thunderbird/releases/1.5beta1.html Seamonkey: http://www.mozilla.org/projects/seamonkey/
This bug has been automatically resolved after a period of inactivity (see above comment). If anyone thinks this is incorrect, they should feel free to reopen it.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → EXPIRED
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.