brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: :block in the Firefox console blocks every request whose URL contains a string

Firefox
~/tips/tip-firefox-console-block

:block analytics.example.com

Blocks requests to a URL fragment from the Firefox console, to test failures.

To see how a page behaves when its analytics script or its font file fails, I need that request to fail. Firefox has a console command for this.

In the Web Console, type :block followed by an unquoted string. Firefox then blocks requests where the URL contains that string.

:block analytics.example.com

The string you block shows up in the Request Blocking sidebar of the Network Monitor. Reload the page, and the requests to that host are blocked. You can try several at once by running the command more than once, for instance for a font file and a tracking script.

To undo it:

:unblock analytics.example.com

The docs say that unblocking a string that was never blocked gives no error, so it is safe to run it twice.

It is a quick way to test a fallback. Does the layout survive without the web font, and does the page still work when a third-party widget never loads? You see it in a minute, and you do not need a firewall rule or a hosts file entry.

Matching is a plain substring test on the URL, so a short string like cdn blocks more than you wanted. Use as much of the address as you need. And since the page does not say how long a block lasts, I would run :unblock when I am done rather than assume it ends with the tab.

Further reading: Firefox Source Docs: Web Console helpers

More Firefox tips view-source:https://www.mozilla.org/#line100 ^ invoice history about:processes right-click the request > Edit and Resend Windows and Linux: Ctrl+B All Firefox tips (10) All topics

Link