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: override the user agent in DevTools to see what another browser gets

Devtools
~/tips/tip-devtools-override-user-agent

User agent > untick "Use browser default"

Check what a server or script sends when the browser claims to be different.

Some sites still decide what to serve by reading the user agent string. To see that decision from the other side I change the string rather than install another browser.

Open the command menu with Ctrl+Shift+P (Cmd+Shift+P on a Mac) and find the panel:

Show Network conditions
User agent > untick "Use browser default"

Pick one from the list or type your own, then reload. The request headers and navigator.userAgent now report the new value. Confirm it in the console:

navigator.userAgent

This is handy when a download page offers the wrong installer, when a site serves a separate mobile version, or when you want to reproduce what a bot with a certain string receives. You can also paste your own test string and see whether your server rule matches it.

Changing the string does not change how the browser renders anything. If a page breaks in Safari because Safari handles some feature differently, pretending to be Safari will not reproduce that. It also only applies while DevTools is open, in that tab. Tick the default box again when you are done.

Further reading: Chrome DevTools: override the user agent string

More Devtools tips Clear site data for one site from Chrome DevTools user.id === 42 $x(path [, startNode]) @media (prefers-color-scheme: dark) { queryObjects(Promise) All Devtools tips (22) All topics

Link