Open Bug 279192 Opened 20 years ago Updated 3 years ago

Inconsistent handling of onclick="location.href='foo.html';>

Categories

(Core :: DOM: Events, defect, P5)

x86
Windows XP
defect

Tracking

()

People

(Reporter: WeirdAl, Unassigned)

References

Details

(Keywords: testcase)

Attachments

(1 file)

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a6) Gecko/20050105

Basically, sometimes Mozilla will honor the onclick event handler, and sometimes
it will honor the href attribute.  About 30% of the time from my testcase,
onclick takes precedence.  (The exception is when the document URL already has
that # character.  In that case, onclick wins out 100% of the time.)

In theory, the href attribute could be equal to "bar.html".

I believe this bug blocks bug 274399, because window.history affects
window.location (or document.location, in our company's testcase).

I was unable to find a clear reference in either the W3C DOM specs or mailing
lists, or within Mozilla's own Bugzilla, as to what the correct behavior is.
This is effectively a dup of bug 274399... we need to decide what behavior we
want here, and whether we care exactly.  Note that pages can get consistent
behavior with return false.
Summary: Inconsistent handling of <a href="#" onclick="location.href='foo.html';> → Inconsistent handling of onclick="location.href='foo.html';>
(In reply to comment #2)
>  Note that pages can get consistent behavior with return false.

Unless the user presses a modifier while clicking on the link. But that's a different story, see bug 319554.

Assignee: events → nobody
QA Contact: ian → events

Bulk-downgrade of unassigned, >=3 years untouched DOM/Storage bug's priority.

If you have reason to believe this is wrong, please write a comment and ni :jstutte.

Severity: normal → S4
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: