Web SDK
Browser support
Supported browsers, local development setup, performance by mode and fixes for common problems.
Supported browsers
The Web SDK runs in recent versions of:
| Browser | Platforms |
|---|---|
| Chrome | Desktop and Android |
| Edge | Desktop |
| Firefox | Desktop |
| Safari | macOS and iOS |
The page must run in a secure context: HTTPS, or localhost during development. On plain
HTTP the browser does not open the camera. If you embed the measurement in an iframe, add
allow="camera" to the iframe.
Local development
- Serve the page from
http://localhostorhttp://127.0.0.1— both count as secure. - Pass
assetOrigin: 'https://neccessory.com'tocreateMeasurement()andprefetchMeasurement(). Onlocalhost,127.0.0.1and*.localhostthe SDK otherwise loads its runtime files from your own server, and the measurement fails to start. - To test on a phone, serve the page over HTTPS — for example, from a preview deployment or through an HTTPS tunnel.
- With a test key, use
delivery: 'batch'in cloud mode. Test keys return synthetic results.
Performance
| Cloud mode | On-device mode | |
|---|---|---|
| Device load | Lower — the metrics are computed in Neccessory cloud | Uses the device CPU for the whole measurement. Older and low-end devices start slower. |
| First start | Downloads much less than on-device mode | Downloads the SDK runtime — tens of megabytes. Call prefetchMeasurement() when the page loads. |
| Network | Steady upload of about 1–1.5 Mbit/s for the whole measurement | Used to load the SDK at start |
| Live values | Arrive with network latency, up to twice per second | Computed on the device |
| Result | Arrives after the measurement ends and is already stored | Available immediately after stop(); your backend stores it |
On a weak connection, cloud mode with delivery: 'auto' finishes the measurement by upload
and still returns a result.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
The camera does not open; load_failed after requestingCamera | Camera permission denied, the camera is used by another app, the page is not on HTTPS, or an iframe lacks allow="camera". | Ask the user to allow camera access in the browser settings and close other apps that use the camera. Serve the page over HTTPS. |
Stuck on loadingModels, or load_failed after it | The network or your CSP blocks cdn.jsdelivr.net or neccessory.com. | Allow both hosts — see Requirements. |
The measurement fails to start on localhost | The SDK loads its runtime files from your local server. | Pass assetOrigin: 'https://neccessory.com'. |
| On-device mode fails to start on your domain | The model grant is missing or expired. | Mint a grant on your backend for each page load and pass it as modelGrant. |
cloud_unreachable | A firewall, proxy or CSP blocks WebSockets. | Keep the default delivery: 'auto', or use 'batch'. Allow the session's wsUrl host in connect-src. |
On-device: onResult never fires | On-device mode has no automatic end. | Call stop() after 30–60 seconds. |
All metrics are null | The signal quality was poor. | Ask the user to face the camera in even light and hold still. Show the onCoach hints — see Signal quality. |
token_expired | The session was created more than 5 minutes before start(). | Create the session right before start(). |
session_already_used | The same session was used twice. | Create a new session for every measurement. |
stream_interrupted | The user switched tabs, or the connection dropped. | Keep the tab in the foreground. Use delivery: 'auto' so the SDK finishes by upload. |
All error codes are listed in Callbacks & errors.