Open Bug 606522 Opened 14 years ago Updated 2 years ago

Clicking on a link with "ping=url" does not send a POST request to "url" when the link is opened in a new window or tab.

Categories

(Firefox :: General, defect)

3.6 Branch
x86_64
Linux
defect

Tracking

()

UNCONFIRMED

People

(Reporter: richardho, Unassigned)

Details

(Whiteboard: DUPEME)

User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.11) Gecko/20101013 Ubuntu/10.04 (lucid) Firefox/3.6.11
Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.11) Gecko/20101013 Ubuntu/10.04 (lucid) Firefox/3.6.11

Suppose there is a link with <a ping="url1" href="url2" ...> link text </a>.
When this link is clicked, the browser navigates the current window or tab to url2 as expected, and also sends a ping (POST request) to url1 as expected.
When this link is ctrl-clicked, opened in new window, or opened in new tab, the browser again displays the page ulr2 as expected in the new tab or window, but the POST request is not sent.

Reproducible: Always

Steps to Reproduce:
Very easy to reproduce:
1. Make a link <a href=something ping=something> link </a>
2. Ctrl-click on the link or
   Right-click on the link and select "Open Link in New Tab" or
   Right-click on the link and select "Open Link in New Window"

Actual Results:  
No POST request sent to the ping url.
This can be checked by running a local web-server listening for any POST requests, setting ping=localhost:..., and then clicking on the link various ways. It seems that only a normal left-click would trigger the ping.

Expected Results:  
There should be a POST request sent to the ping url no matter how the user clicks on the link.

I'm guessing this is a UI bug where certain actions aren't triggering actions they should.
Summary: Clicking on a link with "ping=url" does not send a POST request to url when the link is opened in a new window or tab. → Clicking on a link with "ping=url" does not send a POST request to "url" when the link is opened in a new window or tab.
Component: General → Networking
Product: Firefox → Core
QA Contact: general → networking
Version: unspecified → 1.9.2 Branch
In all the situations you described, the link is not actually being traversed.  The browser UI is just reading its href and setting the location of another window to that string.

Note that in those situations we're also not firing events of various sorts that we fire for a regular left-click, etc.

None of which is a problem, imo; the actions there are the same as "copy link location" followed by pasting in the url bar and hitting enter, and that certainly shouldn't send pings, right?
Component: Networking → General
Product: Core → Firefox
QA Contact: networking → general
Whiteboard: DUPEME
Version: 1.9.2 Branch → 3.6 Branch
Hi Boris,

Sorry for the late response.

The spec for the ping attribute stated that a ping should be sent whenever the user follows a hyperlink. It's arguable that the strongest signal for "following a hyperlink" comes from the document.referrer field. We can see that Firefox does not treat middle-click, ctrl-left-click, or right-click -> open in new window or tab as merely a "copy link location" then pasting it; in all the different variants of clicking, Firefox will set the document.referrer field. In the copy-link-then-paste, the document.referrer is empty. I think it should be the case that whenever the document.referrer is set, a ping should be sent. For example, chrome always sends the ping when it sets document.referrer, but this isn't the case in Firefox:

                          | sets document.referrer |       sends ping       |
                          |------------------------|------------------------|
               Click mode |   Chrome   |  Firefox  |   Chrome   |  Firefox  |
--------------------------+------------+-----------+------------+-----------+
               left-click |    YES     |    YES    |    YES     |    YES    |
             middle-click |    YES     |    YES    |    YES     |     NO    |
          ctrl-left-click |    YES     |    YES    |    YES     |     NO    |
r.click -> new window/tab |     NO     |    YES    |     NO     |     NO    |
--------------------------+------------+-----------+------------+-----------/

Regards,
Richard
(In reply to Boris Zbarsky (:bz) from comment #1)
> None of which is a problem, imo; the actions there are the same as "copy
> link location" followed by pasting in the url bar and hitting enter, and
> that certainly shouldn't send pings, right?

According to Richards list the referrer is set which is not the case if you copy and paste a URL in the url bar and hit enter. BTW: The ping-POST does not show up in the web console.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.