Dynamsoft Barcode Reader Samples for the Web
This repository contains multiple samples that demonstrate how to use the Dynamsoft Barcode Reader JavaScript Edition for creating web-based barcode scanning applications.
System Requirements
Secure Context (HTTPS Deployment)
When deploying your application/website for production, make sure to serve it via a secure HTTPS connection. This is required for two reasons:
- Access to the camera video stream is only granted in a security context. Most browsers impose this restriction.
- Dynamsoft License requires a secure context to work.
Some browsers like Chrome may grant access for http://127.0.0.1 and http://localhost or even for pages opened directly from the local disk (file:///...). This can be helpful for temporary development and testing.
Browser Compatibility
The following table is a list of supported browsers based on the above requirements:
| Browser Name |
Version |
| Chrome |
v78+ |
| Firefox |
v68+ |
| Edge |
v79+ |
| Safari |
v14.5+ |
Apart from the browsers, the operating systems may impose some limitations of their own that could restrict the use of the SDK.
License
A default trial license is included which allows you to test the sample apps for up to 24 hours. You can request a 30-day trial license via the Dynamsoft website to evaluate further.
Once your trial license expires, the SDK will throw an error and cease to function. You can visit the Dynamsoft Customer Portal to view your trial license details. Additionally, it’s possible to extend the trial period via the customer portal, allowing for a total trial duration of 60 days.
Get the Code
Cloning the full repository may be slow due to its extensive history. To get started quickly, you have a few options:
- Download as zip
- Download as tar.gz
- Shallow clone with Git:
git clone https://github.com/Dynamsoft/barcode-reader-javascript-samples.git --depth 1
If you expect unstable network conditions or prefer to work entirely offline, you can download the offline package from Dynamsoft website. This includes the full repository and all required dependencies for offline use.
Running the Samples Locally
The standalone samples in the basics/ folder (hello-world.html, scan-a-single-barcode.html, read-an-image.html) and scenario samples load the SDK from a CDN, so you can open them directly by double-clicking — no web server required (an internet connection is needed).
To browse all available samples, open index.html in your browser — it links to every sample in the repository.
For framework samples, follow the instructions in each subfolder’s README (typically npm install then npm run dev).
If you need a web server for standalone or scenario samples, here’s a quick method using Visual Studio Code:
-
Install the Five Server extension from the VS Code Marketplace.
-
Right-click on an HTML file and select “Open with Five Server”. This will serve the application at http://127.0.0.1:5500/.
Sample Folders
-
basics/ - Three foundational samples: hello-world, scan-a-single-barcode, and read-an-image.
-
scenarios/ - Focused scenario samples that show common real-world uses of Dynamsoft Barcode Reader.
-
frameworks/ - Framework-specific examples demonstrating how to integrate Dynamsoft Barcode Reader into common web and hybrid frameworks.
Vibe Coding with AI Agents
This repository ships an AI coding skill that gives GitHub Copilot, Claude, and Codex deep knowledge of the Dynamsoft Barcode Reader JavaScript SDK — so you can describe what you want and get working code instantly.
How It Works
The skill lives in:
.github/skills/dbr-js-sample-creator/ ← GitHub Copilot (auto-discovered)
.claude/skills/dbr-js-sample-creator/ ← Claude Code (auto-discovered)
.codex/skills/dbr-js-sample-creator/ ← OpenAI Codex (auto-discovered)
No installation or configuration needed — just clone the repo and open it in your AI-enabled editor.
Example Prompts
Open your AI agent (e.g. GitHub Copilot Chat in agent mode) and try:
- “Create a plain HTML barcode scanner that reads from camera and shows results”
- “Build a React component that scans barcodes with proper cleanup”
- “Make a Vue 3 page that decodes barcodes from an uploaded image”
- “Write an ES6 module barcode scanner using the CDN .mjs bundle”
- “Scan QR codes only using a custom JSON template”
The agent will automatically load the skill and generate correct, production-ready code using the right SDK version, license key, API patterns, and framework conventions — without you needing to read any documentation.
frameworks/ - Framework-specific examples demonstrating how to integrate Dynamsoft Barcode Reader into common web and hybrid frameworks.
Documentation
For the developer guide and full API reference of Dynamsoft Barcode Reader JavaScript library, please check out the documentation.
Support
If you have any questions, feel free to contact Dynamsoft support.
Sample List
Hello World
- hello-world.html — Demonstrates continuously scanning and collecting multiple unique barcodes via camera.
- scan-a-single-barcode.html — Demonstrates single-barcode scanning: stops and returns as soon as the first barcode is detected.
- read-an-image.html — Demonstrates how to decode and read barcodes from uploaded image files.
Frameworks
Scenarios
Official Online Demo
- Official Online Demo: Try the Dynamsoft Barcode Reader JavaScript Edition demo (written in Vue) and see how it works in different modes!
评论