Closed Bug 1778021 Opened 3 years ago Closed 3 years ago

Download pdf from google search page

Categories

(Web Compatibility :: Site Reports, defect)

Firefox 102
Desktop
All
defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: plupmartin, Unassigned)

Details

Attachments

(1 file)

Attached image ateca.JPG

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0

Steps to reproduce:

good evening
I have just upgraded to firefox 102, and I have noticed something that didn't happen before, first it was blocked with the downloads, after restarting, what happens now is that if I search in google for example,
"seat ateca pdf", it shows links that contain pdf's, I select the link with the right mouse button, "save link as" and it only saves as html, when before I could "save as" and the pdf would download.
if I click on the link, it allows me to download the pdf.
is the problem that it is not showing "save as" but "save link as"?
I think the latest version had some change about this?
in the download settings I have
application/pdf open in firefox
application/json save file

Actual results:

only shows saves html, not the pdf in google search

Expected results:

download the pdf file with save as

The Bugbug bot thinks this bug should belong to the 'Firefox::File Handling' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → File Handling

I guess that's a side effect of privacy efforts. The link in the search results of Google has NEVER been a direct link.
It's always been a link first going through Google for their tracking, like https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=abc&uact=1&ved=2AhCXKwj9AKAHAOa4AhXf_qQKf__dCH8__noECAoQAQ&url=https%3A%2F%2Fwww.seat.com%2Fcontent%2Fdam%2Fpublic%2Fseat-website%2Fmyco%2F2130%2Fcar-shopping-tools%2Fbrochure-download%2Fbrochures%2Fnew-ateca%2Fcars-models-brochure-newateca-ago-2020.pdf&usg=AxxXxw1xXXxxw0x-0Au__8__X_n_

I hadn't updated firefox for a time... I don't remember what version I had before... 1xx, but until this 102, it worked for me
If I do the same thing in chrome, for example, if it downloads the pdf file,
I have also tested that if I go to the link and go back with the browser, sometimes the download also works, at that moment

I went back to Firefox 75.0 and the behavior there is the same as on the latest Firefox. I confirm that on Chrome you can download it as a pdf.
I'm not sure about the expected behavior but it makes sense to download it directly as a pdf.
Reproducible on macOS 11.6, Windows 10 x64 and on Ubuntu 20.04 x64.

Severity: -- → S4
Status: UNCONFIRMED → NEW
Has STR: --- → yes
Ever confirmed: true
OS: Unspecified → All
Hardware: Unspecified → Desktop

(In reply to Hani Yacoub from comment #4)

I went back to Firefox 75.0 and the behavior there is the same as on the latest Firefox. I confirm that on Chrome you can download it as a pdf.
I'm not sure about the expected behavior but it makes sense to download it directly as a pdf.
Reproducible on macOS 11.6, Windows 10 x64 and on Ubuntu 20.04 x64.

really?
wow... this already unsettles me, I'm sure I've downloaded pdf's in the way I indicate and it works in chrome (I hope I didn't dream it)
anyway if at some point I could make it behave like in other browsers it would be nice

thanks

This is because google is treating Firefox differently from Chrome.

In Firefox, there is a mousedown event listener on the link, which changes the link content from the correct link to the PDF to a redirect URL as illustrated in comment #2.
If the redirect was a "real" http redirect (302 or 301 or w/e) then this would be OK and we'd find the PDF. But it's not; it's an HTML page that needs to be rendered in order to find the javascript and meta tag that does the redirect. So we have no idea that that is going to redirect, and we just download the HTML page.

In Chrome, that mousedown listener is completely absent, so the link stays the same and the browser is able to download the PDF because the website gives it the right PDF link to download.

Chrome uses a ping attribute to do tracking, which Firefox does not support by default for privacy reasons. Presumably this is why Google felt the need to have this interstitial redirect for Firefox, but not Chrome.

Over to web compat because this is ultimately an issue with google serving us suboptimal markup, and fixing it in downloads code would only be possible if we started reading the contents of the file we just downloaded, and then deciding to remove that file again and download something else instead!

Component: File Handling → Desktop
Product: Firefox → Web Compatibility

Removing release tracking flags because we can't fix this inside Firefox.

(In reply to :Gijs (he/him) from comment #6)

This is because google is treating Firefox differently from Chrome.

In Firefox, there is a mousedown event listener on the link, which changes the link content from the correct link to the PDF to a redirect URL as illustrated in comment #2.
If the redirect was a "real" http redirect (302 or 301 or w/e) then this would be OK and we'd find the PDF. But it's not; it's an HTML page that needs to be rendered in order to find the javascript and meta tag that does the redirect. So we have no idea that that is going to redirect, and we just download the HTML page.

In Chrome, that mousedown listener is completely absent, so the link stays the same and the browser is able to download the PDF because the website gives it the right PDF link to download.

Chrome uses a ping attribute to do tracking, which Firefox does not support by default for privacy reasons. Presumably this is why Google felt the need to have this interstitial redirect for Firefox, but not Chrome.

Over to web compat because this is ultimately an issue with google serving us suboptimal markup, and fixing it in downloads code would only be possible if we started reading the contents of the file we just downloaded, and then deciding to remove that file again and download something else instead!

ok I understand.
I have tried something else, if I search "seat ateca pdf", click on the first result, in the same window, it loads the pdf, and then, I go back to the search page, if then on the link, I click save link as, then if it downloads it as pdf (that is if you enter the link and go back if it downloads, if you don't enter and save then no)
Is it related to your explanation?

Closing as wontfix based on Gijs comment.

Removing release tracking flags because we can't fix this inside Firefox.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: