A demo that scans a barcode and performs a product information lookup using the Dynamsoft Barcode Reader (JavaScript edition). The camera is always visible on screen; once a barcode is detected its value is placed in the search input, ready for a query.
index.html— main demo (camera view, filter panel, and search flow)index.css— styles for the demo
- Always-visible camera view that starts scanning automatically on page load
- Click anywhere on the camera view to pause or resume scanning
- Collapsible Filters panel to narrow down which barcodes are accepted:
- Barcode Format — choose a preset (All, 1D Retail, 1D Industrial, 2D Codes) or build a custom format selection
- String Length — accept only barcodes whose text falls within a minimum/maximum character count
- Keyword Rules — add one or more rules that the barcode text must satisfy (contains, does not contain, starts with, ends with, or matches a regex)
- An indicator badge on the Filters button shows when any filter is active
- Result deduplication so the same barcode does not fire repeatedly
- Scanning pauses automatically after a successful read; resume by clicking the camera view
- Text input lets you type or paste a barcode value manually and search without scanning
- Search results are displayed in a text area below the input
- The camera opens and starts scanning automatically.
- When a barcode that passes all active filters is detected, its value is placed in the text input and scanning pauses.
- Click the Search button (or click the camera view to resume and scan again).
- Placeholder product data is shown in the Search Result area.
- Alternatively, type any value into the text input and click Search at any time.
Opening HTML files directly may not work as expected. Instead, run a local development server. Here's a quick method using Visual Studio Code:
- Install the Five Server extension from the VS Code Marketplace.
- Right-click on
index.htmland select "Open with Five Server".
- No real backend is connected; product data in the results is mocked. Replace the
lookupBarcodefunction body to call a real API. - Filters are applied at the SDK level, not as post-processing, so only matching barcodes are surfaced by the result receiver.
- See the root
README.mdfor running instructions and licensing.