← Blog 6 min read

Proximity Sensor API: What Websites Can Detect

Proximity Sensor API: What Websites Can Detect

When you raise a phone to your ear, its screen may switch off to prevent accidental taps. A proximity sensor often makes that possible by detecting whether an object is close to the device. The web platform has explored a similar capability through the Proximity Sensor API, designed to tell a webpage when a nearby surface enters the sensor's range.

Proximity is not a photograph, and it is not a precise map of the room. It is still information about the physical world around a device. Patterns of near and far readings can imply how a person is holding or covering a phone, while differences in sensor behavior may contribute to fingerprinting. The result is a useful lesson in why even simple hardware signals deserve strict boundaries.

Proximity Sensor API detects nearby objects

The proposed ProximitySensor interface is built on the Generic Sensor API. It can expose three values: distance, the reported distance to the nearest visible surface; max, the sensor's maximum range; and near, a simpler true-or-false indication that something is close.

The W3C Proximity Sensor draft describes distance in centimeters but warns that many physical sensors cannot provide reliable precision. Some hardware offers only a near-or-not signal. Reflectiveness, color, translucency, temperature, angle, and sensor construction can all influence a reading.

The specification therefore says proximity should not be treated as an accurate measuring tape. At best, it indicates that an object is somewhere within a sensing range with a degree of certainty.

Why websites might want proximity data

A communication app could disable touch controls when a phone is close to the face. An accessibility interface might respond when a user deliberately covers the sensor. A kiosk or presentation could pause when someone moves away, though other technologies may be more suitable depending on the device and task.

The common thread is an immediate, visible relationship between physical closeness and interface behavior. If covering the sensor produces a clearly expected action, the person can understand what the reading is for.

An ordinary article, store, or form rarely needs to know whether an object is near the phone. Because support is highly limited, developers must also provide manual controls and should never make a core action depend entirely on this experimental sensor.

The API is a draft, not a universal feature

The May 2026 W3C draft states that the Proximity Sensor specification is not implemented in any browser engine and is not expected to advance in its current form. That is unusually important context for readers. A published interface can document a direction for the web without being a capability people can use in normal browsers today.

The broader MDN overview of Sensor APIs explains the common model: sensor subclasses start and stop readings, emit events, require a secure context, and are controlled by permission and Permissions Policy. Proximity follows that architecture in the draft, but its real-world availability remains effectively absent.

Sites should use feature detection rather than browser-name assumptions. More importantly, they should ask whether proximity is necessary at all. A well-designed fallback is not merely a compatibility patch; it is often the more private and dependable experience.

What proximity patterns can reveal

A single “near” event reveals little. A sequence over time can suggest that a phone was lifted, covered, placed in a pocket, set on a surface, or brought close to a face. Those interpretations are uncertain, but persistent collection can turn a small hardware signal into behavioral context.

Sensor characteristics also differ. Maximum range, response timing, noise, and reporting behavior may vary by device. When combined with other browser signals, that variation can contribute to a profile. This is the same accumulation problem discussed in our guide to browser fingerprinting: modest details become more identifying when assembled together.

The W3C draft explicitly recognizes user identification and fingerprinting risk. Its recommended mitigations include reducing reading accuracy and limiting the maximum sampling frequency. Less detail and fewer samples mean fewer opportunities to infer behavior or hardware characteristics.

Permission and Permissions Policy boundaries

The proposed interface is restricted to secure contexts, so it is designed for HTTPS pages. Its policy-controlled feature is named proximity-sensor, with a default allowlist of the same origin. That means a third-party frame should not receive access simply because it is embedded on a page.

The sensor also has an associated permission. Permission should be tied to a clear user action and purpose, not requested automatically on arrival. If a page cannot explain why nearby-object detection improves the current task, it should not ask.

This layered model resembles the safeguards around device orientation and motion. Both expose physical context, both need secure delivery and policy controls, and both benefit from lower precision and shorter collection periods.

How to evaluate any sensor request

Ask three questions. What visible feature needs the data? Why does it need the sensor now? What happens if you say no? Clear answers indicate proportionate design. Vague prompts, background collection, or a broken page after denial suggest that the feature is asking for too much.

Grant access only for a task you initiated, and remove it when that task is finished. Review sensor permission alongside location, camera, microphone, and notifications rather than assuming one decision covers every capability. Our practical browser permissions guide provides a repeatable routine.

Developers should stop readings when a tab is hidden or the feature closes, avoid retaining event histories, and choose boolean near/far information when precise distance adds no user value. Data minimization is strongest when it begins in product design, before a prompt ever appears.

Physical context should remain exceptional

The Proximity Sensor API is a useful case study even though current browser support is absent. It shows how the web standards process weighs convenience against the sensitivity of physical context. A simple sensor can enable thoughtful interactions, but only when access is limited, understandable, and replaceable with a manual option.

Noorani follows that spirit of deliberate browsing. Tracker blocking reduces unnecessary observation, while prayer times, Qibla direction, the Hijri calendar, and offline Quran access provide practical value without an advertising feed. A browser should help you act with purpose and keep the surrounding details of your life from becoming background data.

Browse with more intention

Noorani brings prayer times, Qibla, tracker blocking, and privacy into one calm desktop browser built for how Muslims live online.

Download Noorani