Skip to content

In-app browser iPhone preset changes viewport but keeps desktop User-Agent #35576

Description

@aralynn

What version of the Codex App are you using (From “About Codex” dialog)?

26.721.41059

What subscription do you have?

ChatGPT Free

What platform is your computer?

Darwin 25.5.0 arm64 arm

What issue are you seeing?

The in-app browser's iPhone preset changes viewport metrics, but the HTTP request still uses a desktop User-Agent. This creates a hybrid state on SSR applications that choose mobile/desktop output from the request User-Agent: responsive CSS sees a phone-sized viewport while the server renders the desktop variant.

Observed with the attached minimal reproduction:

Browser state Viewport DPR CSS max-width: 480px HTTP User-Agent / SSR
Codex in-app browser, normal mode 495 × 808 2 false desktop / Desktop
Codex in-app browser, iPhone preset 393 × 852 2 true desktop / Desktop
Chrome, iPhone 14 Pro Max preset 430 × 932 3 true mobile / Mobile

The mismatch is visible only in the in-app browser's mobile preset.

Screenshots

Codex in-app browser — normal mode

Codex in-app browser in normal desktop mode

Codex in-app browser — iPhone preset

Codex in-app browser with an iPhone preset

Chrome — iPhone 14 Pro Max preset

Chrome with an iPhone 14 Pro Max preset

What steps can reproduce the bug?

  1. Run a minimal HTTP server that classifies each request from its User-Agent and returns that server-side result, while client-side JavaScript reports the viewport:
const http = require("http");

http.createServer((req, res) => {
  const ua = req.headers["user-agent"] || "";
  const serverMode = /Mobile|iPhone|Android/i.test(ua) ? "Mobile" : "Desktop";

  res.setHeader("content-type", "text/html; charset=utf-8");
  res.end(`<!doctype html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<h1>SSR: ${serverMode}</h1>
<pre>User-Agent: ${ua}</pre>
<script>
  document.write("<p>Viewport: " + innerWidth + " × " + innerHeight + "</p>");
  document.write("<p>Mobile media query: " +
    matchMedia("(max-width: 480px)").matches + "</p>");
<\/script>`);
}).listen(8091);
  1. Open the page in the Codex in-app browser in normal mode.
  2. Open the device toolbar and select an iPhone preset.
  3. Reload the page so the SSR request is made in the selected mode.
  4. Compare the result with Chrome DevTools using an iPhone preset.

Actual result: the in-app browser changes the viewport but continues sending a macOS desktop Chrome User-Agent. Chrome changes both signals.

What is the expected behavior?

Selecting an iPhone/mobile preset should emulate a mobile device consistently: the viewport, device pixel ratio, and HTTP User-Agent should all switch to the selected mobile profile. Reloaded SSR requests should therefore receive a mobile User-Agent and render the mobile variant.

Additional information

Related closed issues:

This report is narrower than the earlier requests: the mobile preset is now visible and changes viewport dimensions, but it does not change the HTTP User-Agent used for navigation/reload requests.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appIssues related to the Codex desktop appbrowserbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions