Back to main page

Hyperlink dispatchEvent Test

Using dispatchEvent() to simulate a click on a hyperlink does not work properly in Mozilla-based browsers. The handler(s) will run, but the default action will not be executed (i.e., the link will not be followed afterward). There is a bug report on the issue.

IE's fireEvent() method has the same problem. Its click() method can be used instead with no problem, as I have done for this test, but you can't set which button is used, etc.

Test