Skip to content

Commit 10f5403

Browse files
committed
move warning code position;
1 parent a37093b commit 10f5403

6 files changed

+48
-42
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
</head>
1212

1313
<body>
14+
<script>
15+
if(location.protocol === "file:") {
16+
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/".`;
17+
console.warn(message);
18+
alert(message);
19+
}
20+
</script>
21+
1422
<h1 style="font-size: 1.5em;">Use the Default Built-in UI</h1>
1523
<input type="text" id="result" title="Double click to clear!" readonly="true" class="latest-result" placeholder="The Last Read Barcode">
1624
<div id="UIElement" class="UIElement">
@@ -22,13 +30,6 @@ <h1 style="font-size: 1.5em;">Use the Default Built-in UI</h1>
2230
<div id="results"></div>
2331
</div>
2432
<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>
3233
<script>
3334
/** LICENSE ALERT - README
3435
* 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: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
</head>
1212

1313
<body>
14+
<script>
15+
if(location.protocol === "file:") {
16+
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/".`;
17+
console.warn(message);
18+
alert(message);
19+
}
20+
</script>
21+
1422
<h1 style="font-size: 1.5em;">Hide UI Controls</h1>
1523
<div id="UIElement">
1624
<span id='lib-load' style='font-size:x-large' hidden>Loading Library...</span>
@@ -20,13 +28,6 @@ <h1 style="font-size: 1.5em;">Hide UI Controls</h1>
2028
</div>
2129
<input type="text" id="result" readonly="true" class="latest-result" placeholder="The Last Read Barcode">
2230
<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>
3031
<script>
3132
/** LICENSE ALERT - README
3233
* 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: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
</head>
1212

1313
<body>
14+
<script>
15+
if(location.protocol === "file:") {
16+
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/".`;
17+
console.warn(message);
18+
alert(message);
19+
}
20+
</script>
21+
1422
<h1 style="font-size: 1.5em;">Customized UI</h1>
1523
<button id="btn-show-scanner">Start Barcode Scanner</button>
1624
<button id="btn-hide-scanner" hidden>Hide Barcode Scanner</button>
@@ -70,13 +78,6 @@ <h1 style="font-size: 1.5em;">Customized UI</h1>
7078
</div>
7179
<input type="text" id="result" readonly="true" class="latest-result" placeholder="The Last Read Barcode">
7280
<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>
8081
<script>
8182
/** LICENSE ALERT - README
8283
* 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: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010
</head>
1111

1212
<body>
13+
<script>
14+
if(location.protocol === "file:") {
15+
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/".`;
16+
console.warn(message);
17+
alert(message);
18+
}
19+
</script>
20+
1321
<h1 style="font-size: 1.5em;">Enlarge the Video Stream</h1>
1422
<br />
1523
<button id="backToNormal" hidden>Exit Full Screen</button>
@@ -25,13 +33,6 @@ <h1 style="font-size: 1.5em;">Enlarge the Video Stream</h1>
2533
<br />
2634
<input type="text" id="result" readonly="true" class="latest-result" placeholder="The Last Read Barcode">
2735
<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>
3536
<script>
3637
/** LICENSE ALERT - README
3738
* To use the library, you need to first specify a license key using the API "license" as shown below.

2.ui-tweaking/5.read-video-with-custom-default-ui.html

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010
</head>
1111

1212
<body>
13+
<script>
14+
if(location.protocol === "file:") {
15+
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/".`;
16+
console.warn(message);
17+
alert(message);
18+
}
19+
</script>
20+
1321
<h1>Customized Default UI</h1>
1422
<div class="controler">
1523
<div class="selector">
@@ -50,13 +58,6 @@ <h1>Customized Default UI</h1>
5058
<br />
5159
<input type="text" id="result" title="Double click to clear!" readonly="true" class="latest-result" placeholder="The Last Read Barcode">
5260
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.10/dist/dbr.js"></script>
53-
<script>
54-
if(location.protocol === "file:") {
55-
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/".`;
56-
console.warn(message);
57-
alert(message);
58-
}
59-
</script>
6061
<script>
6162
/** LICENSE ALERT - README
6263
* To use the library, you need to first specify a license key using the API "license" as shown below.

4.use-case/2.read-a-drivers-license.html

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
</head>
1212

1313
<body>
14+
<script>
15+
if(location.protocol === "file:") {
16+
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/".`;
17+
console.warn(message);
18+
alert(message);
19+
}
20+
</script>
21+
1422
<span id="hintMSG" class="hintMSG">Aim at the barcode on the driver's license.</span>
1523
<h1 id='header'>Read A Driver's License <a href="javascript:void(0)" id='readAgain' hidden onclick="backToHome()">Retry</a></h1>
1624
<div id="message_box" class="message_box">
@@ -38,13 +46,6 @@ <h1 id='header'>Read A Driver's License <a href="javascript:void(0)" id='readAga
3846
</div>
3947
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.10/dist/dbr.js"></script>
4048
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-code-parser@1.1.0/dist/dcp.js"></script>
41-
<script>
42-
if(location.protocol === "file:") {
43-
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/".`;
44-
console.warn(message);
45-
alert(message);
46-
}
47-
</script>
4849
<script>
4950
/** LICENSE ALERT - README
5051
* To use the library, you need to first specify a license key using the API "license" as shown below.

0 commit comments

Comments
 (0)