# What is JavaScript spoofing detection?

> JavaScript spoofing detection is a page proving a fingerprint value was rewritten by script: from the override's own traces, or from a context it missed.

Source: https://mosaicbrowser.com/glossary/javascript-spoofing-detection

## JavaScript spoofing detection: how a page finds a rewritten value

JavaScript spoofing detection is a page working out that a browser value, such as the User-Agent, the GPU or the screen, was rewritten by a script instead of reported by the browser. It looks for traces the rewrite leaves on the object, and for a worker, iframe or request header that still tells the truth.

![JavaScript spoofing detection, drawn as a mosaic of tiles](https://mosaicbrowser.com/covers/javascript-spoofing-detection.webp)

JavaScript spoofing detection matters to anyone using a fingerprint tool that works by injecting a script. That script redefines `navigator.platform`, wraps `getParameter` on WebGL, adds noise to a canvas, and so on. Every one of those edits is made after the browser has already built the real object, and that order is what a detector exploits.

## What JavaScript spoofing detection reads on the object

A real browser property has a shape: it lives on a prototype, its getter has a name like `get userAgent`, it has a fixed `length`, and calling `toString` on it prints `[native code]`. A replacement written in JavaScript has to copy every detail of that shape, in every place it can be read. Most get one or two wrong. Prototype tampering detection is the family of checks for exactly this, and CreepJS, a public test page, counts the misses as "lies".

We learned it on ourselves. Before our engine moved these values inside the browser itself, we spoofed in JavaScript too, and a diff against a real Chrome found that all 28 of our accessors were anonymous. In Chrome, `Object.getOwnPropertyDescriptor(Navigator.prototype, 'userAgent').get.name` is `"get userAgent"`. Ours was an empty string. A page could list every override in one loop without calling `toString` once. The same diff found a hidden global we had named `__mosaic__`, invisible to `Object.keys` and plain to `Object.getOwnPropertyNames(window)`.

Mosaic is a desktop app

Email yourself the link and open it on your computer.

[How it works: Fingerprints set inside the browser](https://mosaicbrowser.com/features/engine)

## A context the script never reached

A page is not one JavaScript world. Iframes, dedicated workers, shared workers and service workers each start with their own copy of `navigator` and the graphics APIs. A spoof has to arrive in every one of them before the page's first read, and the page decides where to look.

Our own miss: a worker that created a second worker produced an unpatched grandchild. The outer worker read the spoofed renderer and the inner one read the real chip. Once the fix landed, a profile set to `Apple M2 Pro` on an M4 Max read `Apple M2 Pro` in the page, in classic and module workers, in a nested worker pair and in a SharedWorker.

## Values JavaScript cannot reach

Some answers never pass through a page script. The `User-Agent` request header, the `Sec-CH-UA` client hints and the TLS handshake all leave the browser before any page code runs. A script that changes `navigator.userAgent` and not the header makes the two disagree, and the server sees both. The [client hints](https://mosaicbrowser.com/glossary/client-hints-fingerprinting) and [TLS fingerprinting](https://mosaicbrowser.com/glossary/tls-fingerprinting) entries list what goes out at that layer.

## Two spoofs make a third value

The last tell is the most surprising one. Layer a JavaScript spoof over a browser that already changes the same value, and the two do not cancel. They compose into a value neither side meant to produce, which is the kind of contradiction a consistency scanner exists to find. That is why our launcher adds no JavaScript spoof at all when a profile runs on our own engine.

![A Mosaic leak test: every surface a site reads, checked from inside the profile page](https://mosaicbrowser.com/shots/leak-test.png)
*The leak test reads a profile from inside its own page*

## How Mosaic handles it

Nothing is spoofed with injected JavaScript on Tesseract Chrome. The fingerprint values are changed inside the [engine](https://mosaicbrowser.com/features/engine), so the real property returns the profile's value, in the page, its frames and its workers, with no wrapper to inspect. Mosaic's Detection tests include CreepJS's prototype tampering and proxy detection pages, so you can run the checks above against a profile and read the result yourself. [Why we built our own Chromium](https://mosaicbrowser.com/blog/why-we-built-our-own-chromium) tells how we got there.

## Questions

### Can a browser extension spoof a fingerprint without being detected?

An extension changes values from JavaScript, so it leaves the same kinds of traces any script does, and it often misses workers and some frames. A page that compares those contexts, or inspects the rewritten properties, can see the rewrite.

### What is a lie in CreepJS?

CreepJS calls a property a lie when the way it answers does not match how the real browser answers: a wrong function name, a descriptor in the wrong place, or source text that is not native. It counts them per property, and its prototype test page lists each one by name.

### Why do workers matter for spoofing detection?

A worker is a separate JavaScript context with its own navigator. A spoof written into the page often never runs there, so the worker reports the real thread count, platform or GPU, and the page can compare the two answers.

### Is spoofing inside the engine the same as spoofing in JavaScript?

No. A value changed in the browser's own code comes out of the real property in every context, with nothing wrapped. JavaScript spoofing replaces the property after the fact, which is what these checks look for.

## Related

[CDP detection: how a page notices DevTools is driving it](https://mosaicbrowser.com/glossary/cdp-detection): CDP detection is a page noticing that the Chrome DevTools Protocol is driving the browser, usually because Puppeteer or Playwright enabled Runtime.

[Browser fingerprinting: how sites recognise a browser without cookies](https://mosaicbrowser.com/glossary/browser-fingerprinting): Browser fingerprinting is recognising a browser by reading its hardware, settings and rendering quirks instead of storing a cookie. How sites do it.

[How do sites detect anti-detect browsers?](https://mosaicbrowser.com/guides/how-do-sites-detect-anti-detect-browsers): Sites detect anti-detect browsers by contradictions: a page and its workers disagreeing, a GPU name the driver does not match, fonts from another OS.

[Why we built our own Chromium instead of injecting JavaScript](https://mosaicbrowser.com/blog/why-we-built-our-own-chromium): Mosaic changes fingerprint values inside its own engine. Three measured differences between Chrome and plain Chromium explain why that matters.

[An anti-detect browser with its own Chromium engine](https://mosaicbrowser.com/features/engine): Mosaic is an anti-detect browser with its own Chromium engine, Tesseract Chrome: stock Chromium source, with fingerprint values changed inside the engine.







[HTTP/2 fingerprinting: identifying a client by its first frames](https://mosaicbrowser.com/glossary/http2-fingerprinting): HTTP/2 fingerprinting names the software behind a connection from its SETTINGS values, window update, priorities and header order, before any script runs.

## See javaScript spoofing detection on a real profile

Mosaic shows the values a site reads, per profile, and runs a leak test from inside the profile’s own page. Free covers 3 profiles with no card, and Pro is $25 a month for any number of them.

Mosaic is a desktop app

Email yourself the link and open it on your computer.
