lindell / lindell/JsBarcode

Can't seem to get 128-JS to work on local filesystem

Open
#451 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.9k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Hi. I am trying to make a barcode generator for my work. I've followed your instructions and it works perfectly.
However, when I download the script from the CDN at https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/barcodes/JsBarcode.code128.min.js
and then try to use it locally from the filesystem on my page it prints an error:

```html
Uncaught SyntaxError: Invalid regular expression: /^[_These characters could not be pasted_]*/: Range out of order in character class (at JsBarcode.code128.min.js:834:28)
at new RegExp ()
at a (JsBarcode.code128.min.js:834:28)
at e.default (JsBarcode.code128.min.js:846:21)
at new e (JsBarcode.code128.min.js:803:150)
at o (JsBarcode.code128.min.js:494:17)
at JsBarcode.code128.min.js:545:25
at t.value (JsBarcode.code128.min.js:380:35)
at x..x..x. (JsBarcode.code128.min.js:540:36)
at E (JsBarcode.code128.min.js:532:222)
at Go (Main.html:21:2)
```
I have a sinking feeling it is related to the file's encoding. I've tried different encoding to no avail.
If it is related to the file's encoding, could I please request a version of the file or instructions on how to change the characters in the array to standard characters? I only need 0-9, A-Z, a-z. The main keyboard symbols are a bonus but not needed.

I've just designed a simple page that loads whatever text is in a textbox at the click of a button and then displays it as a barcode.

```html





//JsBarcode("#barcd11", document.getElementById("testInp1").value);

function Go()
{
JsBarcode("#barcd11", document.getElementById("testInp1").value);
}

```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the error with the downloaded JsBarcode.code128.min.js file and the supplied HTML page, focusing on line 834 and the generated regular expression. Compare the CDN bundle with the project source and test whether the failure is specific to local loading or a browser environment. Done means the local Code128 bundle generates the requested barcode or the repository documents the supported workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.