astro-toolbar-ua
v0.1.2
Published
Astro dev toolbar app for switching user agent strings — test platform detection and browser-specific behavior without leaving the browser.
Maintainers
Readme
astro-toolbar-ua
Switch user agent strings from the Astro dev toolbar. Test platform detection and browser-specific behavior without leaving your browser.

Install
npx astro add astro-toolbar-uapnpm astro add astro-toolbar-uayarn astro add astro-toolbar-uaOr install manually:
npm install -D astro-toolbar-ua// astro.config.mjs
import { defineConfig } from "astro/config";
import toolbarUA from "astro-toolbar-ua";
export default defineConfig({
integrations: [toolbarUA()],
});Usage
Open the UA Switch panel in the Astro dev toolbar. Pick a preset or paste a custom UA string. The page reloads with the new user agent applied.
A notification dot appears on the toolbar icon when a UA override is active.
Presets
| Category | Presets | | ------------ | --------------------- | | Desktop | macOS, Windows, Linux | | Mobile | iOS, Android | | Browsers | Safari, Firefox, Edge |
You can also enter any custom UA string directly.
How it works
- A synchronous
<head>script reads alocalStoragekey and overridesnavigator.userAgentviaObject.defineProperty— before any page scripts run - The toolbar UI writes the selected UA string to
localStorageand reloads the page - Only runs during
astro dev— production builds are not affected
Limitations
- Only overrides client-side
navigator.userAgent. Does not modify server-side request headers. Object.definePropertyonnavigator.userAgentworks in Chromium and Firefox. Safari may not support it in all versions.
License
MIT
