Skip to main content

Supported readers

pickReader() picks the best supported driver for the current browser: connect() and start() may show a browser device or permission prompt, so call them from a click handler.

Connecting once, not every time

The browser remembers which reader an origin may use, so choosing a device is a one-time authorization rather than part of connecting. The SDK splits the two: stopScanning() stops delivering taps and leaves the device connected, so the next scan starts without a prompt - use it for component teardown between scans. disconnect() is the explicit release, for when another tab or a desktop application needs the reader. stop() keeps its original “stop and release” meaning and is a deprecated alias for disconnect(). Render the pairing control from the connection state, not from a guess:
Only authorization-required is cleared by a user gesture, so a button gated on that state stays hidden once a reader is paired, and a reader unplugged and plugged back in reconnects on its own. Both hold while the browser keeps the grant. When it does not, the state returns to authorization-required and the button comes back - see Troubleshooting.

Package exports