Skip to content

Commit d40de0a

Browse files
committed
add a warning;
1 parent 4775dad commit d40de0a

16 files changed

+111
-0
lines changed

1.hello-world/1.hello-world.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
<body>
1414
Loading...
1515
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.10/dist/dbr.js"></script>
16+
<script>
17+
if(location.protocol === "file:") {
18+
const message = `The page is opened via file:// and "BarcodeScanner" may not work properly. Please open the page via https:// or host it on "http://localhost/".`;
19+
console.warn(message);
20+
alert(message);
21+
}
22+
</script>
1623
<script>
1724
/** LICENSE ALERT - README
1825
* To use the library, you need to first specify a license key using the API "license" as shown below.

1.hello-world/10.read-video-pwa/helloworld-pwa.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
<h1 style="font-size: 1.5em;">Hello World for PWA</h1>
1616
Loading...
1717
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.10/dist/dbr.js"></script>
18+
<script>
19+
if(location.protocol === "file:") {
20+
const message = `The page is opened via file:// and "BarcodeScanner" may not work properly. Please open the page via https:// or host it on "http://localhost/".`;
21+
console.warn(message);
22+
alert(message);
23+
}
24+
</script>
1825
<script>
1926
/** LICENSE ALERT - README
2027
* To use the library, you need to first specify a license key using the API "license" as shown below.

1.hello-world/11.read-video-requirejs.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
<h1 style="font-size: 1.5em;">Hello World for RequireJS</h1>
1313
Loading...
1414
<script src="https://cdn.jsdelivr.net/npm/requirejs@2.3.6/require.js"></script>
15+
<script>
16+
if(location.protocol === "file:") {
17+
const message = `The page is opened via file:// and "BarcodeScanner" may not work properly. Please open the page via https:// or host it on "http://localhost/".`;
18+
console.warn(message);
19+
alert(message);
20+
}
21+
</script>
1522
<script>
1623
requirejs(['https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.10/dist/dbr.js'], function({
1724
BarcodeReader,

1.hello-world/12.read-video-es6.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
<body>
1313
<h1 style="font-size: 1.5em;">Hello World for ES6</h1>
1414
Loading...
15+
<script>
16+
if(location.protocol === "file:") {
17+
const message = `The page is opened via file:// and "BarcodeScanner" may not work properly. Please open the page via https:// or host it on "http://localhost/".`;
18+
console.warn(message);
19+
alert(message);
20+
}
21+
</script>
1522
<script type="module">
1623
import { BarcodeReader, BarcodeScanner } from 'https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.10/dist/dbr.mjs';
1724
/** LICENSE ALERT - README

1.hello-world/2.read-an-image.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ <h1 style="font-size: 1.5em;">Read Barcode from Images</h1>
3131
}
3232
</style>
3333
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.10/dist/dbr.js"></script>
34+
<script>
35+
if(location.protocol === "file:") {
36+
const message = `The page is opened via file:// and "BarcodeScanner" may not work properly. Please open the page via https:// or host it on "http://localhost/".`;
37+
console.warn(message);
38+
alert(message);
39+
}
40+
</script>
3441
<script>
3542
/** LICENSE ALERT - README
3643
* To use the library, you need to first specify a license key using the API "license" as shown below.

1.hello-world/9.read-video-electron/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ <h1 style="font-size: 1.5em;">Hello World for Electron</h1>
1717
</div>
1818
<input id="resultText" type="text" readonly="true">
1919
<script src="./node_modules/dynamsoft-javascript-barcode/dist/dbr.js"></script>
20+
<script>
21+
if(location.protocol === "file:") {
22+
const message = `The page is opened via file:// and "BarcodeScanner" may not work properly. Please open the page via https:// or host it on "http://localhost/".`;
23+
console.warn(message);
24+
alert(message);
25+
}
26+
</script>
2027
<script src="action.js"></script>
2128
</body>
2229

2.ui-tweaking/1.read-video-show-result.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ <h1 style="font-size: 1.5em;">Use the Default Built-in UI</h1>
2222
<div id="results"></div>
2323
</div>
2424
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.10/dist/dbr.js"></script>
25+
<script>
26+
if(location.protocol === "file:") {
27+
const message = `The page is opened via file:// and "BarcodeScanner" may not work properly. Please open the page via https:// or host it on "http://localhost/".`;
28+
console.warn(message);
29+
alert(message);
30+
}
31+
</script>
2532
<script>
2633
/** LICENSE ALERT - README
2734
* To use the library, you need to first specify a license key using the API "license" as shown below.

2.ui-tweaking/2.read-video-no-extra-control.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ <h1 style="font-size: 1.5em;">Hide UI Controls</h1>
2020
</div>
2121
<input type="text" id="result" readonly="true" class="latest-result" placeholder="The Last Read Barcode">
2222
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.10/dist/dbr.js"></script>
23+
<script>
24+
if(location.protocol === "file:") {
25+
const message = `The page is opened via file:// and "BarcodeScanner" may not work properly. Please open the page via https:// or host it on "http://localhost/".`;
26+
console.warn(message);
27+
alert(message);
28+
}
29+
</script>
2330
<script>
2431
/** LICENSE ALERT - README
2532
* To use the library, you need to first specify a license key using the API "license" as shown below.

2.ui-tweaking/3.read-video-with-external-control.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ <h1 style="font-size: 1.5em;">Customized UI</h1>
7070
</div>
7171
<input type="text" id="result" readonly="true" class="latest-result" placeholder="The Last Read Barcode">
7272
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.10/dist/dbr.js"></script>
73+
<script>
74+
if(location.protocol === "file:") {
75+
const message = `The page is opened via file:// and "BarcodeScanner" may not work properly. Please open the page via https:// or host it on "http://localhost/".`;
76+
console.warn(message);
77+
alert(message);
78+
}
79+
</script>
7380
<script>
7481
/** LICENSE ALERT - README
7582
* To use the library, you need to first specify a license key using the API "license" as shown below.

2.ui-tweaking/4.difference-video-size.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ <h1 style="font-size: 1.5em;">Enlarge the Video Stream</h1>
2525
<br />
2626
<input type="text" id="result" readonly="true" class="latest-result" placeholder="The Last Read Barcode">
2727
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.10/dist/dbr.js"></script>
28+
<script>
29+
if(location.protocol === "file:") {
30+
const message = `The page is opened via file:// and "BarcodeScanner" may not work properly. Please open the page via https:// or host it on "http://localhost/".`;
31+
console.warn(message);
32+
alert(message);
33+
}
34+
</script>
2835
<script>
2936
/** LICENSE ALERT - README
3037
* To use the library, you need to first specify a license key using the API "license" as shown below.

0 commit comments

Comments
 (0)