--- title: 15 Sensors Panel --- # Chrome DevTools — Sensors Panel --- ## What the Sensors Panel Is The Sensors panel is a DevTools drawer tool that lets you **simulate physical device sensors and environmental conditions** inside a browser tab running on your desktop machine. Without the panel you would need a real phone in São Paulo, a device tilted at exactly 45 degrees, or a machine set to Tokyo Standard Time to test every code path in a location-aware, motion-driven, or timezone-sensitive web application. The Sensors panel removes all of those constraints. Core capabilities at a glance: | Sensor / Override | What is simulated | Browser API it affects | |---|---|---| | Geolocation | GPS coordinates, unavailable, permission-denied | `navigator.geolocation` | | Device Orientation | Alpha / Beta / Gamma tilt angles | `DeviceOrientationEvent` | | Device Motion | Acceleration, rotation rate | `DeviceMotionEvent` | | Touch events | Pointer-style touch on desktop | `TouchEvent`, `PointerEvent` | | Idle state | Active, idle, locked screen | `IdleDetector` API | | Timezone | IANA timezone string override | `Intl`, `Date`, `toLocaleString` | | Locale | `navigator.language` language tag | `navigator.language`, `Intl` | | Hardware Concurrency | Logical CPU count | `navigator.hardwareConcurrency` | | Device Memory | RAM size in gigabytes | `navigator.deviceMemory` | | Prefers-color-scheme | Light / dark / no-preference | CSS media query, JS `matchMedia` | All overrides are **scoped to the current DevTools session and the current tab**. Closing DevTools or reloading without the panel active restores real values. Nothing is written to disk. --- ## How to Open the Sensors Panel ### Method 1 — More Tools menu (most reliable) 1. Open DevTools with `F12` / `Cmd+Option+I` (Mac) / `Ctrl+Shift+I` (Windows/Linux). 2. Click the **three-dot kebab menu** ( `⋮` ) in the top-right of DevTools. 3. Hover **More Tools**. 4. Click **Sensors**. The panel opens as a drawer tab at the bottom. ### Method 2 — Command Menu 1. Open DevTools. 2. Press `Cmd+Shift+P` (Mac) or `Ctrl+Shift+P` (Windows/Linux) to open the Command Menu. 3. Type `sensors` and select **Show Sensors**. ### Method 3 — Drawer tab bar If you have previously opened the panel, a **Sensors** tab persists in the drawer tab bar at the bottom. Click it directly. --- ## UI Layout — All Sections Explained The Sensors panel is divided into collapsible sections from top to bottom: ``` ┌─────────────────────────────────────────────────┐ │ SENSORS │ ├─────────────────────────────────────────────────┤ │ Location ▾ No override │ ├─────────────────────────────────────────────────┤ │ Orientation ▾ No override │ ├─────────────────────────────────────────────────┤ │ Touch ▾ No override │ ├─────────────────────────────────────────────────┤ │ Idle Detection ▾ No override │ ├─────────────────────────────────────────────────┤ │ Timezone ▾ No override │ ├─────────────────────────────────────────────────┤ │ Locale ▾ No override │ ├─────────────────────────────────────────────────┤ │ Hardware Concurrency ▾ No override │ ├─────────────────────────────────────────────────┤ │ Prefers-color-scheme ▾ No override │ ├─────────────────────────────────────────────────┤ │ Device Memory ▾ No override │ └─────────────────────────────────────────────────┘ ``` Each row has a disclosure triangle to expand its controls. "No override" means the browser is reporting real values. The moment you change a field, the tab uses the spoofed value and a blue dot appears next to the section name as a reminder that an override is active. --- ## 1. Location (Geolocation) Simulation ### Why it matters `navigator.geolocation` returns the machine's real physical position. On a desktop in New York you cannot test what your food-delivery app shows a user in Tokyo without this panel. ### Selecting a Preset Location 1. Expand the **Location** section. 2. Click the **Location** dropdown (default: "No override"). 3. Choose from the built-in presets: | Preset city | Approximate coordinates | |---|---| | Berlin | 52.520008, 13.404954 | | London | 51.509865, -0.118092 | | Moscow | 55.755826, 37.617300 | | Mountain View | 37.386052, -122.083851 | | Mumbai | 19.075984, 72.877656 | | San Francisco | 37.774929, -122.419416 | | Shanghai | 31.222222, 121.458056 | | São Paulo | -23.547501, -46.636391 | | Tokyo | 35.689487, 139.691706 | Chrome updates this list; your version may contain additional entries. ### Custom Lat/Long Coordinates 1. In the **Location** dropdown, scroll to the bottom and select **Other…** (or **Manage** depending on your Chrome version). 2. Click **Add location**. 3. Fill in: - **Location name** — a human label (e.g., "Test Office NYC"). - **Latitude** — decimal degrees, range -90 to +90. - **Longitude** — decimal degrees, range -180 to +180. - **Timezone** — an optional IANA string (e.g., `America/New_York`). - **Locale** — optional language tag (e.g., `en-US`). 4. Click **Add**. 5. Your custom location now appears in the preset dropdown for this and future sessions. ### Simulating Location Unavailable Select **Location unavailable** from the dropdown. `getCurrentPosition` and `watchPosition` will call their `error` callback with `PositionError.code === 2` (POSITION_UNAVAILABLE). ### Simulating Permission Denied Select **Permission denied** from the dropdown. The Geolocation API calls the error callback with `PositionError.code === 1` (PERMISSION_DENIED) — exactly as if the user had blocked the permission prompt. ### The Geolocation API — Code Reference ```js // One-time position request navigator.geolocation.getCurrentPosition( (position) => { console.log('Latitude :', position.coords.latitude); console.log('Longitude:', position.coords.longitude); console.log('Accuracy :', position.coords.accuracy, 'm'); console.log('Altitude :', position.coords.altitude); // null if unavailable console.log('Speed :', position.coords.speed); // null if unavailable console.log('Heading :', position.coords.heading); // null if unavailable console.log('Timestamp:', new Date(position.timestamp)); }, (error) => { switch (error.code) { case GeolocationPositionError.PERMISSION_DENIED: // 1 console.error('User denied permission'); break; case GeolocationPositionError.POSITION_UNAVAILABLE: // 2 console.error('Position unavailable'); break; case GeolocationPositionError.TIMEOUT: // 3 console.error('Request timed out'); break; } }, { enableHighAccuracy: true, // requests GPS-quality fix timeout: 5000, // ms before TIMEOUT error maximumAge: 0 // always fetch fresh position } ); // Continuous watch (fires on each position change) const watchId = navigator.geolocation.watchPosition( (pos) => console.log('Moved to', pos.coords.latitude, pos.coords.longitude), (err) => console.error(err.message) ); // Stop watching navigator.geolocation.clearWatch(watchId); ``` ### Testing with Google Maps Embed Open any page that embeds a `