Regular Website: `ar-web-bridge`
<script>
window.AR_CONFIG = {
gatewayUrl: "https://customer.example.com/personnel/resolve",
};
</script>
<script src="https://cdn.ar-defense.com/ar-web-bridge/0.1.0/ar-web-bridge.bundle.js"></script>
Reference for the browser bridge used inside the AR Defence host app. This page is structured like product documentation: setup, function reference, event reference, resolver responsibility, and implementation patterns.
Pick one integration mode. For most websites, use ar-web-bridge. For SPA / PWA apps that want raw events and custom resolver control, use ar-host-sdk.
<script>
window.AR_CONFIG = {
gatewayUrl: "https://customer.example.com/personnel/resolve",
};
</script>
<script src="https://cdn.ar-defense.com/ar-web-bridge/0.1.0/ar-web-bridge.bundle.js"></script>
<script src="https://cdn.ar-defense.com/ar-host-sdk/0.1.0/ar-host-sdk.js"></script>
<script>
const resolveTag = window.ARHostSDK.createGatewayPersonnelResolver({
gatewayUrl: "https://customer.example.com/personnel/resolve",
});
window.AR = window.ARHostSDK.createBridge({ resolveTag });
</script>
The browser contract is intentionally small. The host app reads raw RFID / NFC / QR values and the browser app decides how to use them.
startRfidScan(), stopRfidScan()
Emits rfid.epc and optionally rfid.personnel
startNfcScan(), stopNfcScan()
Emits nfc.uid and optionally nfc.personnel
startQrScan()
Emits qr.value or qr.cancelled
getHostInfo(), on(...)
Reads host metadata and subscribes to events
Use RFID for crew-level or batch flows. The host app emits raw EPC reads. Name resolution is not performed in the host app.
startRfidScan()Starts the native RFID reader. The browser should listen for rfid.epc and optionally rfid.personnel.
async function beginCrewScan() {
await window.AR.stopNfcScan();
await window.AR.startRfidScan();
}
stopRfidScan()Stops the native RFID session. Call this when leaving the screen or changing to a different scan mode.
async function endCrewScan() {
await window.AR.stopRfidScan();
}
Use NFC for individual tags, personal cards, or single-member confirmation flows.
startNfcScan()Starts the native NFC session. The browser should listen for nfc.uid and optionally nfc.personnel.
async function beginPersonalScan() {
await window.AR.stopRfidScan();
await window.AR.startNfcScan();
}
stopNfcScan()Stops the native NFC session. Call this after receiving the accepted tag or when leaving the personal scan screen.
async function endPersonalScan() {
await window.AR.stopNfcScan();
}
QR scanning is host-native. Typical use is provisioning or assigning a printed RFID label to a selected member.
startQrScan()Opens the host-native QR flow. The result is returned by events, not by the function return value.
async function assignByQr(member) {
selectedMember = member;
await window.AR.startQrScan();
}
window.AR.on("qr.value", (value) => {
assignRfidTagToMember(selectedMember, value);
});
Use host functions to read runtime metadata and to subscribe to bridge events.
getHostInfo()Requests a host snapshot. The host answers through the host.info event.
window.AR.on("host.info", (info) => {
console.log(info.embeddedAppUrl);
console.log(info.rfid?.state);
});
await window.AR.getHostInfo();
on(eventName, handler)Registers an event listener and returns an unsubscribe function.
const off = window.AR.on("rfid.personnel", (person) => {
addMember(person);
});
// later
off();
Use raw events if you want your own lookup flow. Use personnel events if the resolver is configured.
rfid.epc
Raw EPC string
Host app read an RFID tag. No names are resolved in the host app.
rfid.personnel
"ID - Name"
Resolver mapped the EPC to a person.
nfc.uid
Raw UID string
Host app read an NFC tag. No names are resolved in the host app.
nfc.personnel
"ID - Name"
Resolver mapped the NFC UID to a person.
qr.value
String
QR scan succeeded.
qr.cancelled
null
QR flow closed without result.
host.info
Host-defined object
Version, runtime, selected embedded URL, and capability snapshot.
ar.error
{ source, code, message, timestamp }
Bridge, host, scan, or resolver error.
Name resolution belongs in the gateway. The host app should only emit EPC and UID values.
createGatewayPersonnelResolver({ gatewayUrl })This helper POSTs the raw tag to the configured backend and converts the response into the bridge personnel label.
const resolveTag = window.ARHostSDK.createGatewayPersonnelResolver({
gatewayUrl: "https://customer.example.com/personnel/resolve",
});
window.AR = window.ARHostSDK.createBridge({ resolveTag });
Production integrations should point the resolver to the customer backend. Mapping raw RFID and NFC identifiers to people is a backend responsibility.
These are the three common integration flows used by customers.
window.AR.on("rfid.personnel", (person) => {
addMemberToCrew(person);
});
await window.AR.startRfidScan();
window.AR.on("nfc.personnel", (person) => {
setSingleMember(person);
});
await window.AR.startNfcScan();
await window.AR.startQrScan();
window.AR.on("qr.value", (value) => {
saveAssignedTag(value);
});