Repository navigation
Preview browser has no way to set a mobile User-Agent for testing mobile vs desktop web #32358
akshat-OwO
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
What happened
I'm testing my own app in the desktop preview browser. Like many e-commerce sites (Amazon, for example), it serves a different mobile web or desktop web experience depending on the
User-Agentheader. The preview browser has no way to change the User-Agent or switch to a mobile device mode. A narrower panel doesn't help, because the site decides on the server. So I can only test the desktop version in T3 Code.Diagnosis
In
apps/desktop/src/preview/BrowserSession.ts, preview sessions always send Electron's built-in User-Agent. That's deliberate: a comment there says rewriting it breaks Cloudflare Turnstile (error 600010). The only rewrite is a hardcoded one that removesElectron/…for Microsoft Teams. The preview code has no device emulation (Emulation.setUserAgentOverride,setDeviceMetricsOverride,setTouchEmulationEnabled), the panel has no user-agent or device setting, and the agent'spreview_*tools have no option for it.Because of the Turnstile issue, a global override is the wrong fix. An opt-in, per-tab "device mode" (mobile user agent, viewport and touch, like Chrome DevTools device toolbar) would avoid it.
Steps to reproduce
Version
0.1.8-nightly.20261107.4301 (desktop app and local server)
Environment
macOS 27.0 (arm64), T3 Code Desktop nightly, local server
Evidence
Related issues
#30014 and #22444. Both are sites rejecting the built-in user agent; a per-tab user-agent override would help with those too.
Fix applied or workaround
For your own app only: add a development-only override the server checks first, such as a query parameter or cookie. There's no workaround for third-party sites.
Filed by
Produced by Claude Code (Opus 5.5) via T3 Code triage
All reactions