A Firefox extension that spoofs the time zone and (optionally) the User-Agent reported by the browser to websites — across all contexts: the main page, iframes (any nesting depth), Dedicated Worker, Shared Worker, and Service Worker.
Websites infer approximate location and browser characteristics via Intl.DateTimeFormat, Date.prototype.getTimezoneOffset, navigator.userAgent, and similar APIs — and they do this not only in the main window but also inside workers, where ordinary time-zone spoofing extensions usually can't reach. This extension patches all these points consistently, so every context returns the same spoofed values.
- Time zone spoofing —
Intl.DateTimeFormat,Date.prototype.getTimezoneOffset,toString/toDateString/toTimeString/toLocaleString/toLocaleDateString/toLocaleTimeString - Optional User-Agent spoofing —
navigator.userAgent,appVersion,platform,vendor,language,languages,maxTouchPoints,oscpu(Firefox), and related properties - HTTP header spoofing — optionally modifies outgoing
Accept-LanguageandUser-Agentheaders to match the selected timezone and browser identifier - Site exceptions — spoofing is ON everywhere by default; the sites you list (one domain per line in the popup, subdomains included) are exceptions where the environment stays completely native — nothing is wrapped, nothing is modified. An empty list spoofs everywhere as before
- Full context coverage — main window, iframe (including nested iframe-within-iframe and
about:blank/srcdocframes), Dedicated Worker, Shared Worker, Service Worker - Consistent locale identity — the default locale of every Intl API (
DateTimeFormat,NumberFormat,Collator,DisplayNames,PluralRules,ListFormat,RelativeTimeFormat) resolves to the spoofed timezone's language; the globalDateobject passes native-look checks (toString,name,length) - Real system clock untouched —
Date.now()and the actual OS clock are not modified; only how the date is interpreted and displayed in the chosen time zone is changed - Cached formatters —
Intl.DateTimeFormatandIntl.NumberFormatformatters are cached to avoid timing detection (important against detectors like CreepJS) - CSP-safe — works on sites with strict Content-Security-Policy (Spotify Web Player and similar) via declarative injection through
world: "MAIN" - No enumerable globals — all shared state lives inside the closure of a single file and is not enumerable from the outside
- Temporal API support — patches
Temporal.Now.timeZoneIdand related methods when available - Number format spoofing —
Intl.NumberFormatandNumber.prototype.toLocaleStringuse the spoofed locale
A single content script injected by the browser directly into the page's main world (world: "MAIN" in the manifest). This bypasses the page's CSP, since such injection is not treated as code added by the page itself.
Intl.DateTimeFormat,Intl.NumberFormat, andDate.prototypemethods are patched once per window, with cached formatters.navigator.userAgentand related properties are patched viaObject.definePropertyonNavigator.prototype.- All patched functions are masked as
[native code]via a customtoStringwrapper. - iframe: instead of
MutationObserver(which is always asynchronous), the gettercontentWindow/contentDocumentonHTMLIFrameElement.prototypeis patched — the spoof is applied at the moment of access, not at DOM insertion. Recursive patching handles iframe-within-iframe. - Dedicated / Shared Worker: the
Worker/SharedWorkerconstructors are wrapped so that our patch runs before the worker's original script, loaded viaimportScripts()— without blocking synchronous XHR on the main thread. - Service Worker:
navigator.serviceWorker.register()is intercepted to learn the exact URL of the worker script, sent to the background viabridge.js.
Reads saved tz / ua / enabled / spoofHeaders / whitelist (the storage key is historical — it holds the exception list) from browser.storage.local and passes them to main.js through three mechanisms:
- DOM attributes on
<html>— available immediately atdocument_start. sessionStorage/localStoragefallback (__tzGuardConfig) — survives page reloads and bfcache restores.CustomEvent(tz-guard-update-config) — for live updates when settings change in the popup.
Service Workers cannot be patched via blob: URLs (forbidden by spec). Therefore network-response interception is used:
webRequest.onBeforeRequest+webRequest.filterResponseData(requireswebRequestFilterResponse.serviceWorkerScript) splices the patch code into the beginning of the Service Worker script response.- The filter must be installed in
onBeforeRequest, not later, to avoid Firefox's internal script byte-cache (Invalid request ID). - Known Service Worker URLs are persisted in
storage.local(swUrls) so patches survive browser restarts.
When "Spoof HTTP Headers" is enabled in the popup, the extension modifies outgoing request headers via webRequest.onBeforeSendHeaders:
Accept-Language— a single language tag derived from the selected timezone's language (e.g.,Europe/Moscow→ru-RU), exactly matching the spoofednavigator.languagesUser-Agent— set to the custom UA if provided
The exception list is enforced at every layer — an excluded (listed) site cannot observe a single trace of the extension, while every other site is spoofed exactly as before:
- Background — header rewriting and Service Worker patch injection are skipped for excluded origins (
isSiteAllowed/requestPageUrl) - Per frame —
bridge.jsresolves each frame's hostname (includingabout:blank/srcdocframes, which inherit the embedding origin) and decides independently - Main world —
spoof/main.jsreads the per-origin cached config synchronously atdocument_start; if the origin is a known exception site, not even theWorker/SharedWorkerconstructors are wrapped — the page sees a byte-for-byte native environment. On exception sitesbridge.jsalso writes nothing to the page'ssessionStorage/localStorage, sets no injection attributes on<html>and dispatches no custom events — zero traces left in the page
Inheritance rule — an exception site's status extends to everything it spawns:
- Frames it embeds receive the exception status automatically (e.g. the Cloudflare Turnstile iframe
challenges.cloudflare.cominside an excepted page stays native — no need to list it manually). For cross-origin ancestors,location.href— the one location property readable across origins per spec — is parsed for the hostname, so nothing new is exposed to the page - Network requests (headers, Service Worker patching) are likewise skipped if any ancestor in the request's origin chain — containing document, initiator or any parent frame — belongs to an exception site. The background rebuilds each request's frame chain from its per-tab frame registry
Direct subdomains (*.example.com) are always matched; unrelated sites stay untouched.
Matching rules (kept identical in all copies): lowercase, scheme/path/port stripped, a bare domain example.com matches example.com itself and any *.example.com subdomain.
- Extension Enabled — master toggle; disables all spoofing when turned off.
- Spoof HTTP Headers — toggles modification of outgoing
Accept-LanguageandUser-Agentheaders. - Timezone — select the timezone to report.
- User-Agent — choose from presets or enter a custom string.
- Site Exceptions — one domain per line; each listed site (and its subdomains) stays fully native; empty = spoof everywhere.
about:debugging#/runtime/this-firefox→ Load Temporary Add-on → selectmanifest.json.- Open the popup, choose a time zone (and optionally a User-Agent), adjust toggles, Save & Apply.
- Fully close and reopen the tab (not just F5 — temporary extensions in Firefox get a new
moz-extension://UUID on every reload).
manifest.json
bridge.js — isolated world: reads storage, passes config via DOM + storage events
spoof/
main.js — all patches (Intl/Date/UA/iframe/Worker/SharedWorker/Temporal), one file, one IIFE
background/
background.js — network response interception, header spoofing, SW URL tracking
build_worker.js — patch-code generator for Service Worker injection (module)
frontend/
popup.html
popup.js
icons/
storage— saves the selected tz/ua and settings locally; persists known SW URLs.<all_urls>(host permission) — the spoof must apply on any site, before the site's own scripts run.webRequest,webRequestBlocking,webRequestFilterResponse,webRequestFilterResponse.serviceWorkerScript— required for patching Service Workers via network response interception and for HTTP header modification.
- Indexed access
window[n]/window.frames[n]— numeric index access is exotic internalWindowProxybehavior, not an ordinary JS property.Object.definePropertycannot intercept it. The first such access returns real data; subsequent accesses through.contentWindoware already patched. - "Dead" (detached) iframes — a reference to a removed iframe's window, obtained through a non-standard access path, may remain unpatched.
- Live config changes — settings changes are broadcast live to open tabs. Disabling the extension (toggle or adding a site to exceptions) fully unwraps all already-patched APIs — the page returns to a pristine native state without a reload. Enabling/other changes apply at event arrival; a page reload is still the guaranteed way to start in the new state from the very first script.
- Exception list changes need a reload too — pages that were already open when the list was edited keep their patched state until the tab is reloaded; content scripts cannot be un-patched retroactively.
- OS clock untouched — the extension only changes what is reported through JS APIs and HTTP headers. The operating system clock and time zone are not modified.
| Before | After | |
|---|---|---|
| BrowserLeaks — HTTP Headers | ![]() |
![]() |
| BrowserLeaks — JS APIs | ![]() |
![]() |
| CreepJS — Fingerprint | ![]() |
![]() |
| CreepJS — Timezone | ![]() |
![]() |
| CreepJS — Workers | ![]() |
![]() |
MIT









