Increasingly, web-enabled devices are capable of determining their orientation; that is, they can report data indicating changes to their orientation with relation to the pull of gravity. In particular, hand-held devices such as mobile phones can use this information to automatically rotate the display to remain upright, presenting a wide-screen view of the web content when the device is. A web testing deep dive: The MDN web testing report. For the last couple of years, we've run the MDN Web Developer Needs Assessment (DNA) Report, which aims to highlight the key issues faced by developers building web sites and applications. Periodically, the whole of MDN is built, by our Node code, in a GitHub Action. A Python script bulk-publishes this to Elasticsearch. Our Django server queries the same Elasticsearch via /api/v1/search. The site-search page is a static single-page app that sends XHR requests to the /api/v1/search endpoint.
Msn Web Messenger
tl;dr; The old /favicon.ico
was 15KB and due to bad caching was downloaded 24M times in the last month totaling ~350GB of server-to-client traffic which can almost all be avoided.
How to save the planet? Well, do something you can do, they say. Ok, what I can do is to reduce the amount of electricity consumed to browse the web. Mozilla MDN Web Docs, which I work on, has a lot of traffic from all over the world. In the last 30 days, we have roughly 70M pageviews across roughly 15M unique users.
A lot of these people come back to MDN more than once per month so good assets and good asset-caching matter.
I found out that somehow we had failed to optimize the /favicon.ico
asset! It was 15,086 bytes when, with Optimage, I was quickly able to turn it down to 1,153 bytes. That's a 13x improvement! Here's what that looks like when zoomed in 4x:
The next challenge was the Cache-Control
. Our CDN is AWS Cloudfront and it respects whatever Cache-Control
headers we set on the assets. Because favicon.ico
doesn't have a unique hash in its name, the Cache-Control
falls back to the default of 24 hours (max-age=86400) which isn't much. Especially for an asset that almost never changes and besides, if we do decide to change the image (but not the name) we'd have to wait a minimum of 24 hours until it's fully rolled out.
Another thing I did as part of this was to stop assuming the default URL of /favicon.ico
and instead control it with the <link href='/favicon.323ad90c.ico' type='image/x-icon'>
HTML meta tag. Now I can control the URL of the image that will be downloaded.

Our client-side code is based on create-react-app
and it can't optimize the files in the client/public/
directory.
So I wrote a script that post-processes the files in client/build/
. In particular, it looks through the index.html
template and replaces...

...with...
Plus it makes a copy of the file with this hash in it so that the old URL still resolves. But now can cache it much more aggressively. 1 year in fact.


In summary
Combined, we used to have ~350GB worth of data sent from our CDN(s) to people's browsers every month.
Just changing the image itself would turn that number to ~25GB instead.
The new Cache-Control hopefully means that all those returning users can skip the download on a daily basis which will reduce the amount of network usage even more, but it's hard to predict in advance.
Related posts
- Previous:
- How to simulate slow lazy chunk-loading in React25 March 2021
- Related by category:
- Fastest way to find out if a file exists in S3 (with boto3)16 June 2017Web development
- How to throttle AND debounce an autocomplete input in React01 March 2018Web development
- How to create-react-app with Docker17 November 2017Web development
- Be very careful with your add_header in Nginx! You might make your site insecure11 February 2018Web development
- Displaying fetch() errors and unwanted responses in React06 February 2019Web development
- Related by keyword:
- favicon2dots12 February 2007
Hacks Blog
Pyodide Spin Out and 0.17 Release
We are happy to announce that Pyodide has become an independent and community-driven project. We are also pleased to announce the 0.17 release for Pyodide with many new features and improvements. Pyodide consists of the CPython 3.8 interpreter compiled to WebAssembly which allows Python to run in the browser.The post Pyodide Spin Out and 0.17 Release appeared first on Mozilla Hacks - the Web developer blog.
Never too late for Firefox 88
April is upon us, and we have a most timely release for you — Firefox 88. In this release you will find a bunch of nice CSS additions including :user-valid and :user-invalid support and image-set() support, support for regular expression match indices, removal of FTP protocol support for enhanced security, and more! This blog post […]The post Never too late for Firefox 88 appeared first on Mozilla Hacks - the Web developer blog.
QUIC and HTTP/3 Support now in Firefox Nightly and Beta
Support for QUIC and HTTP/3 is now enabled by default in Firefox Nightly and Firefox Beta and we are planning to start a rollout on the release in Firefox Stable Release 88. HTTP/3 will be available by default by the end of May.The post QUIC and HTTP/3 Support now in Firefox Nightly and Beta appeared first on Mozilla Hacks - the Web developer blog.
Eliminating Data Races in Firefox – A Technical Report
We successfully deployed ThreadSanitizer in the Firefox project to eliminate data races in our remaining C/C++ components. In the process, we found several impactful bugs and can safely say that data races are often underestimated in terms of their impact on program correctness. We recommend that all multithreaded C/C++ projects adopt the ThreadSanitizer tool to enhance code quality.The post Eliminating Data Races in Firefox – A Technical Report appeared first on Mozilla Hacks - the Web developer blog.
A web testing deep dive: The MDN web testing report
For the last couple of years, we've run the MDN Web Developer Needs Assessment (DNA) Report, which aims to highlight the key issues faced by developers building web sites and applications. This has proved to be an invaluable source of data for browser vendors and other organizations to prioritize improvements to the web platform. This year we did a deep dive into web testing, and we are delighted to be able to announce the publication of this follow-on work, available at our insights.developer.mozilla.org site along with our other Web DNA publications.The post A web testing deep dive: The MDN web testing report appeared first on Mozilla Hacks - the Web developer blog.
Mdn Webxr
Help improve MDN Web Docs
Msn Web Browser

Mdn Web Docs Html
All parts of MDN (docs and the site itself) are created by an open community of developers. Please join us! Pick one of these ways to help:
