8

Since Firefox is natively supporting .webp images, they are displayed as webp images on web sites providing this option. How can we globally force Firefox to always fallback to jpg or png images?

I know .webp images support is an improvement, but for my case I need to export a lot of pictures from websites using a drag'n drop from Firefox to Windows Explorer. As webp images are not supported natively by Windows, this is useless... I would like to get the standard image instead.

Remark: Before Firefox v70, it was possible to force it in tweaking about:config : "image.http.accept" = "image/webp,*/*" > change to "*/*" But this tweak is not working anymore.

Sly Mat
  • 502
  • 6
  • 10
  • 2
    Wouldn't something like _"How to disable support for webp images in Firefox?"_ be a better title? (The "fallback" and "supported" parts are confusing, I feel.) Also, did you try to set a specific list of image formats in `image.http.accept` (probably also with some `q` to set your preferences), rather than just `/`? – Arjan Oct 28 '19 at 17:30
  • Can you give an example of a website that used to give images but now gives webp. – harrymc Oct 28 '19 at 17:35
  • @harrymc, for me google.com [returns a few WebP images](https://i.stack.imgur.com/X5glD.png) (at least when requested from Amsterdam). – Arjan Oct 29 '19 at 17:44
  • Example: https://www.decathlon.fr/p/sac-de-trail-running-mixte-10l-noir-et-rouge/_/R-p-168332?mc=8489273&c=GRIS_BLEU – Sly Mat Oct 29 '19 at 19:14

2 Answers2

5

"image.http.accept" = "image/webp,*/*" > change to "*/*"

This change would still leave it up to the server to make a choice for the best format, including formats you don't like and formats that the browser does not even support.

Instead, for your use case you'd better set specific preferences, including quality values:

Quality values, or q-values and q-factors, are used to describe the order of priority of values in a comma-separated list. It is a special syntax allowed in some HTTP headers and in HTML. The importance of a value is marked by the suffix ';q=' immediately followed by a value between 0 and 1 included, with up to three decimal digits, the highest value denoting the highest priority. When not present, the default value is 1.

So, something like:

  • image/png,image/*;q=0.8,*/*;q=0.5 (which was used up to Firefox 46)
  • or more specific with a low quality value for WebP: image/webp;0.1,image/png;q=0.9,image/jpeg;q=0.8,image/*;q=0.7,*/*;q=0.6

(I've not tested this. Maybe servers only use WebP when explicitly allowed by the browser.)

Arjan
  • 30,974
  • 14
  • 75
  • 112
  • +1. For May 2021, on Fedora 33 with Firefox 88.0, I was having this issue. Originally, I tried [jscher2000's Don't "Accept" image/webp](https://addons.mozilla.org/en-US/firefox/addon/dont-accept-webp/) addon and also enabled it for private browsing but I would still get webp when I saved images from most sites. Going to `about:config` and changing `image.http.accept` from empty string to `image/webp;0.1,image/png;q=0.9,image/jpeg;q=0.8,image/*;q=0.7,*/*;q=0.6` as suggested above, then reloading the page that had images, it worked great and I was able to save as png! – zpangwin May 13 '21 at 19:32
3

I have created a test case HTML that looks like:

<!doctype html>
<html>
<picture>
  <source srcset="pic.webp" type="image/webp">
  <source srcset="pic.jpg" type="image/jpeg"> 
  <img src="pic.jpg" type="image/jpeg"> 
</picture>
</html>

With this test I was able to test when Firefox does return a JPG image and when a WEBP image.

  • image.http.accept = */*
    This was not enough - the image that is displayed is the .webp variant. In fact, this setting had no effect in any way.

  • image.webp.enabled = false
    This setting caused Firefox to display the .jpg. It was enough by itself.

Note: The tests were done using Firefox v70. I consider setting image.webp.enabled to be a temporary workaround, and the problem with image.http.accept to be a bug.

I would suggest reporting the bug to the Firefox developers, and I'm sure/hope that this will be fixed in a future version.

harrymc
  • 455,459
  • 31
  • 526
  • 924
  • image.webp.enabled = false is ok, but the ideal would be that the webp image is displayed if no jpg is set in the picture tag. – Sly Mat Oct 29 '19 at 19:11
  • Then the title I proposed did not fully summarize the question, @SlyMat :-) – Arjan Oct 29 '19 at 20:00
  • See my addition at the end of the answer. – harrymc Oct 29 '19 at 20:10
  • Why would it be expected that `image.http.accept = */*` would/should not prefer the WebP image? Is that documented somewhere? (To me, that just tells the server that anything goes, but maybe WebP has some specific documented handling?) – Arjan Oct 29 '19 at 20:18
  • @Arjan: The syntax of "image/webp,\*/\*" says that webp is preferred, or anything else if unavailable. The syntax of "\*/\*" does not say that the browser supports webp, so the website cannot assume this support. – harrymc Oct 29 '19 at 20:22
  • Hmmm, unless a server should treat WebP differently from, say, PNG and JPEG, I'd say that `*/*` just matches _any_ type, hence including WebP? – Arjan Oct 29 '19 at 20:24
  • @Arjan: Yes it does, but webp is new and the client browser could predate it. – harrymc Oct 29 '19 at 20:39