Closed Bug 331087 Opened 18 years ago Closed 15 years ago

Dispatching click-event to an anchor does not execute url in href

Categories

(Core :: DOM: Events, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 395917

People

(Reporter: mattias.zetterberg, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b) Gecko/20050217
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b) Gecko/20050217

I simulate a click on an anchor with an url in href and a javascript alert in onclick. In previous versions (1.7.3 and earlier) it works, ie both the action in onclick and href executes. In version 1.7.5 and later the onclick is the only thing that executes.

WORKS WITH:Win XP Pro SP2, Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20040910
DONT WORK: Win XP Pro SP2, Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041217


Reproducible: Always

Steps to Reproduce:
1.Open testcase DispatchEvent.html
2.Use mouse to click the link named Activate
3.

Actual Results:  
The javascript alert declared in Targetlink appears.

Expected Results:  
The javascript alert declared in Targetlink appears. A new window opens with url to Mozilla homepage.
Probably it doesn't work because the dispatched event is untrusted.
(In reply to comment #2)
> Probably it doesn't work because the dispatched event is untrusted.
> 
Why is the event now untrusted when this worked before? If this now is correct, is there a workaround to achieve the same effect?
(In reply to comment #3)
> Why is the event now untrusted when this worked before? If this now is correct,
> is there a workaround to achieve the same effect?
Because there are security concerns involved with it. Code from the browser could also be listening to those same click events and they need to be able to distinguish between user generated events and events generated by js.
There is no real workaround, afaik.
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: