Blog

Why the Platform Token Sits Before the Engine

Token order in a user agent string looks deliberate and is not. It reflects the order in which each element was added, preserved because reordering would break checks that assume position.

The oldest tokens sit leftmost

The first product token and its comment date from the earliest generation of the format. Everything added later was appended rather than inserted.

Appending was the safe operation. A site check scanning from the start of the string continues to find what it expects when new content arrives after it.

This gives the string a rough chronology. Reading left to right moves forward through the eras in which each token became necessary.

Platform detail landed in the first comment

Operating system and device information went into the comment attached to the first product, because that was the only comment slot that existed when platform reporting began.

It stayed there through every subsequent change. Moving it would have broken code that reads the first parenthesised block expecting platform data.

The consequence is that the most-changed part of the string sits in the oldest structural position. Device fields for platforms invented decades later occupy a slot designed for something else.

Engine tokens came with the compatibility era

Engine identifiers appeared once sites began branching on rendering behaviour, which was after platform reporting was established. They were appended after the first comment.

Some engine tokens carry their own comments, which is why a string can contain several parenthesised blocks with entirely different internal conventions.

Each block follows the convention of the era that created it. There is no shared field vocabulary across them and never was.

Browser identity often comes last

The token actually naming the browser frequently sits at or near the end, because that browser was the most recent arrival in a string built from inherited compatibility tokens.

This inverts the intuitive reading. The leftmost product name is usually the least informative part of a modern string, and the rightmost the most.

Parsers that take the first product as the browser therefore get the wrong answer on almost every mainstream browser. Ordering intuition is actively misleading here.

Order is stable enough to exploit carefully

Within a browser family, order is consistent across builds, which is why regular expressions anchored to position work in practice. They work because vendors avoid reordering.

That stability is a courtesy rather than a guarantee. Nothing in the specification requires it, and vendor changes have shifted positions before.

Treating order as a strong hint and never as a contract is the right posture. It is reliable enough to parse against and fragile enough to warrant a fallback.