HTTP Sec-CH-UA-Platform Header

Der HTTP-Header Sec-CH-UA-Platform ist ein Low-Entropy Request-Header aus den User Agent Client Hints, der das Betriebssystem des Geräts übermittelt. Er wird standardmäßig ohne Opt-In gesendet und ist essentiell für OS-spezifische Features wie Tastatur-Shortcuts oder Download-Links.

Typ

Request-Header

Syntax

Der Header gibt das Betriebssystem als Quoted String an.

http
Sec-CH-UA-Platform: "Windows"
Sec-CH-UA-Platform: "macOS"

Direktiven

Die Direktiven definieren das zugrunde liegende Betriebssystem des Geräts.

"Windows"
Microsoft Windows in beliebiger Version. Keine Version-Info in Low-Entropy Variant, nur OS-Name.
"macOS"
Apple macOS (ehemals Mac OS X). Deckt alle Desktop Macs ab.
"Android"
Google Android auf Mobile Devices und Tablets.
"Linux"
Linux-Distributionen wie Ubuntu, Fedora oder Debian auf Desktop.
"iOS"
Apple iOS auf iPhone und iPad.
"Chrome OS"
Google Chrome OS auf Chromebooks.

Beispiele

Nachfolgend finden Sie praktische Anwendungsbeispiele für den Sec-CH-UA-Platform-Header.

Beispiel 1 Windows Download Page

http
GET /download HTTP/1.1
Host: software.example.com
Sec-CH-UA-Platform: "Windows"
Sec-CH-UA-Mobile: ?0

Windows-Desktop erhält .exe Installer-Link prominent displayed, macOS .dmg und Linux .deb Links als Alternativen.

Beispiel 2 macOS Keyboard Shortcuts

http
GET /editor HTTP/1.1
Host: app.example.com
Sec-CH-UA-Platform: "macOS"

HTTP/1.1 200 OK
Content-Type: text/html

<kbd>⌘</kbd> + <kbd>S</kbd> to Save

Mac-Nutzer sehen Command-Symbol ⌘ statt Ctrl in Keyboard-Shortcuts, Server rendert OS-spezifische Help-Texte.

Beispiel 3 Android PWA Install Prompt

http
GET /app HTTP/1.1
Host: pwa.example.com
Sec-CH-UA-Platform: "Android"
Sec-CH-UA-Mobile: ?1

HTTP/1.1 200 OK
Content-Type: text/html

<button onclick="installPWA()">Add to Home Screen</button>

Android-Nutzer erhält PWA-Install-Prompt, iOS zeigt Safari-spezifischen "Add to Home Screen" Dialog, Desktop versteckt Button.

Platform Detection Flow

Platform Client Hint Ablauf

Vorteile für die Systemarchitektur

  • Low-Entropy Default: Wird immer gesendet, ermöglicht OS-Detection ab erstem Request ohne Accept-CH Negotiation
  • Simplified Download Pages: Automatische Binary-Auswahl erspart Nutzern manuelle OS-Wahl, reduziert falsche Downloads
  • Progressive Enhancement: Basis-Platform reicht für viele Use Cases, detaillierte Version via Sec-CH-UA-Platform-Version nur bei Bedarf

Spezifikation

User-Agent Client Hints – WICG Draft https://wicg.github.io/ua-client-hints/

Weitere Spezifikationen

Sec-CH-UA Header, Accept-CH Header