demo · v141
Smart Card Connect
Probe navigator.smartCard, list readers, connect, and send a real APDU (a SELECT command to the standard PIV applet). The page handles every standard error mode and surfaces the raw SW1/SW2 in the response.
Heads up
Web Smart Card is exposed only to Isolated Web Apps. In a plain web page (this one)
navigator.smartCard is undefined — the probe will report that and the demo simulates the call shape so you can still see what your IWA would do.
click probe to start
No call yet.
the call
const ctx = await navigator.smartCard.establishContext();
const readers = await ctx.listReaders();
if (!readers.length) throw new Error("no readers");
const conn = await ctx.connect(readers[0], "shared", { preferredProtocols: ["t1"] });
const select = new Uint8Array([0x00, 0xA4, 0x04, 0x00, 0x09,
0xA0, 0x00, 0x00, 0x03, 0x08, 0x00, 0x00, 0x10, 0x00, 0x00]);
const r = await conn.transmit(select);
console.log("SW1 SW2:", r.slice(-2).toString("hex"));
see also
- Web Smart Card API — feature index
- ChromeStatus entry
- Spec