fix: default viewport and engine-aligned User-Agent #73

Merged
steve merged 1 commits from fix/70-default-viewport-ua-alignment into main 2026-02-24 01:29:37 +00:00
Collaborator

Summary

  • Add per-engine UA constants (DefaultFirefoxUserAgent, DefaultChromiumUserAgent) with DefaultUserAgent kept as backward-compatible alias
  • initBrowser now auto-selects the matching UA based on opt.Browser when the caller hasn't explicitly set one — fixes Firefox UA being applied to Chromium instances
  • Add 1920x1080 default viewport to NewBrowser (previously had none — a strong headless signal)
  • NewInteractiveBrowser also gains engine-aware UA selection (keeps its existing 1280x720 viewport)
  • Tests cover UA constant content, backward-compat alias, and mergeOptions viewport/UA behavior

Closes #70
Relates to #68

Test plan

  • go build ./... succeeds
  • go test ./... all pass (including 8 new tests)
  • go vet ./... clean
  • Verify cmd/browser/pkg/browser/flags.go still compiles with DefaultUserAgent alias

🤖 Generated with Claude Code

## Summary - Add per-engine UA constants (`DefaultFirefoxUserAgent`, `DefaultChromiumUserAgent`) with `DefaultUserAgent` kept as backward-compatible alias - `initBrowser` now auto-selects the matching UA based on `opt.Browser` when the caller hasn't explicitly set one — fixes Firefox UA being applied to Chromium instances - Add 1920x1080 default viewport to `NewBrowser` (previously had none — a strong headless signal) - `NewInteractiveBrowser` also gains engine-aware UA selection (keeps its existing 1280x720 viewport) - Tests cover UA constant content, backward-compat alias, and mergeOptions viewport/UA behavior Closes #70 Relates to #68 ## Test plan - [x] `go build ./...` succeeds - [x] `go test ./...` all pass (including 8 new tests) - [x] `go vet ./...` clean - [ ] Verify `cmd/browser/pkg/browser/flags.go` still compiles with `DefaultUserAgent` alias 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Claude added 1 commit 2026-02-24 01:28:24 +00:00
fix: set default viewport for NewBrowser and align User-Agent with engine
All checks were successful
CI / vet (pull_request) Successful in 1m6s
CI / build (pull_request) Successful in 1m11s
CI / test (pull_request) Successful in 1m11s
6647e4f63d
NewBrowser previously had no viewport (strong headless signal) and used a
Firefox User-Agent unconditionally, even for Chromium instances (detectable
mismatch).

Add per-engine UA constants (DefaultFirefoxUserAgent, DefaultChromiumUserAgent)
and auto-select the matching UA in initBrowser when the caller hasn't set one
explicitly. Keep DefaultUserAgent as a backward-compatible alias.

Add 1920x1080 default viewport to NewBrowser (most common desktop resolution).
NewInteractiveBrowser keeps its existing 1280x720 default but also gains
engine-aware UA selection.

Closes #70

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
steve merged commit 8eb69c1dee into main 2026-02-24 01:29:37 +00:00
steve deleted branch fix/70-default-viewport-ua-alignment 2026-02-24 01:29:37 +00:00
Sign in to join this conversation.