Closed Bug 291199 Opened 20 years ago Closed 20 years ago

links with javascript onclick events do not function.

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
major

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: webmaster, Assigned: bugzilla)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3

If a link whose markup contains an onclick event is clicked, that link will not
function (browser will not attempt to visit destination URL). I've experienced
this problem on many sites, but to test it I wrote a simple page with this markup:
----------------------------------------------------------------------

<html>
<head><title>Firefox 1.0.3 Bug Test</title></head>
<body>
  <p><a href="http://www.yahoo.com" onclick="return confirm('Do you really want
to go to Yahoo.com?');">Yahoo.com</a></p>
  <p><a href="http://www.google.com" onclick="alert('You are about to go to
Google!');">Google.com</a></p>
</body>
</html>

----------------------------------------------------------------------------
Clicking on the links produces a confirm or alert dialogue as expected, but
afterwords the browser does not attempt to visit the destination URLs, even if
the "ok" button is clicked in the confirm dialogue (function returns true). This
seems to be true of form elements including submit buttons as well. In Internet
Explorer these links function as normal links, simply showing the javascript
beforehand.

Reproducible: Always

Steps to Reproduce:
1. Paste the markup included in this report into an HTML file
2. View the HTML file in Firefox 1.0.3
3. Click either of the two links

Actual Results:  
The browser failed to visit the link's destination URL.

Expected Results:  
Unless the javascript function in the link returns false, the browser should
redirect to the link's specified URL.

I'm reporting this as "major" because it affects the usability of a large number
of high-profile sites.
I guess this is invalid and definitly not used on "high-profile sites"
IE,Opera and Firefox all do the same, open the link and ignore the onclick
I'm marking this fixed. It is working in the current nightly.
I get properly redirected to yahoo or google after confirming either alertbox.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Comment #1 is not valid, Peter van der Woude forgot to remove the line-breaks in
his testcase.
I just checked in Firefox 1.02 and 1.03 the tescase functioned properly in both.
Status: RESOLVED → UNCONFIRMED
Resolution: FIXED → ---
Attached file testcase
marking this WFM if anybody does experience this problem in 1.03, please feel
free to reopen the bug.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago20 years ago
Resolution: --- → WORKSFORME
After experimenting, I discovered that this bug goes away when Tab Browsing
Extensions are disabled, and is likely a bug with the extension itself.

FYI, The "high profile sites" I was having trouble with included Yahoo search
preferences and basecamphq.com
Updating extensions fixed the problem. Sorry for the trouble.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: