You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: hello-world/10.read-video-pwa/README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# JavaScript Hello World Sample - PWA
1
+
# Hello World Sample for PWA
2
2
3
3
[PWA](https://web.dev/progressive-web-apps/) is short for Progressive Web Apps which stand for web applications that have been designed to behave like platform-specific (native) applications. Check out the following on how to implement Dynamsoft Barcode Reader JavaScript SDK (hereafter called "the library") into a PWA application.
4
4
@@ -129,7 +129,7 @@ For more information, refer to [Making PWAs work offline with Service workers](h
129
129
130
130
A web manifest file contains a list of information about a website in a JSON format. This information is used to present the web app correctly for installation on a device.
131
131
132
-
In our example, we first create a file "helloworld-pwa.webmanifest" with the following content:
132
+
In our example, we first create a file "helloworld-pwa.json" with the following content:
133
133
134
134
```json
135
135
{
@@ -161,7 +161,7 @@ In our example, we first create a file "helloworld-pwa.webmanifest" with the fol
161
161
Then we include the file in the <head> block of the helloworld-pwa.html file:
[PWA](https://web.dev/progressive-web-apps/) is short for Progressive Web Apps which stand for web applications that have been designed to behave like platform-specific (native) applications. Check out the following on how to implement Dynamsoft Barcode Reader JavaScript SDK (hereafter called "the library") into a PWA application.
4
4
5
5
## Official Sample
6
6
7
-
* <atarget = "_blank"href="https://demo.dynamsoft.com/Samples/DBR/JS/1.hello-world/10.read-video-pwa/helloworld-pwa.html">Hello World in PWA - Demo</a>
8
-
* <atarget = "_blank"href="https://github.com/Dynamsoft/barcode-reader-javascript-samples/tree/main/1.hello-world/10.read-video-pwa">Hello World in PWA - Source Code</a>
7
+
* <atarget = "_blank"href="https://demo.dynamsoft.com/Samples/DBR/JS/hello-world/pwa/helloworld-pwa.html">Hello World in PWA - Demo</a>
8
+
* <atarget = "_blank"href="https://github.com/Dynamsoft/barcode-reader-javascript-samples/tree/main/hello-world/pwa">Hello World in PWA - Source Code</a>
9
9
10
10
## Preparation
11
11
@@ -20,41 +20,93 @@ First, create a file with the name "helloworld-pwa.html" and fill it with the fo
constmessage=`The page is opened via file:// and some SDKs may not work properly. Please open the page via https:// or host it on "http://localhost/".`;
32
+
console.warn(message);
33
+
alert(message);
34
+
}
35
+
</script>
36
+
<script>
37
+
/** LICENSE ALERT - README
38
+
* To use the library, you need to first specify a license key using the API "initLicense" as shown below.
* You can visit https://www.dynamsoft.com/customer/license/trialLicense?utm_source=github&product=dbr&package=js to get your own trial license good for 30 days.
47
+
* Note that if you downloaded this sample from Dynamsoft while logged in, the above license key may already be your own 30-day trial license.
48
+
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=10.0.20&utm_source=github#specify-the-license or contact support@dynamsoft.com.
49
+
* LICENSE ALERT - THE END
50
+
*/
51
+
52
+
(asyncfunction () {
53
+
try {
54
+
// Create a `CameraEnhancer` instance for camera control and a `CameraView` instance for UI control.
if (ex.message.includes("network connection error")) {
100
+
errMsg =
101
+
"Failed to connect to Dynamsoft License Server: network connection error. Check your Internet connection or contact Dynamsoft Support (support@dynamsoft.com) to acquire an offline license.";
102
+
} else {
103
+
errMsg =ex.message|| ex;
104
+
}
105
+
console.error(errMsg);
106
+
alert(errMsg);
107
+
}
108
+
})();
109
+
</script>
58
110
</body>
59
111
60
112
</html>
@@ -129,7 +181,7 @@ For more information, refer to [Making PWAs work offline with Service workers](h
129
181
130
182
A web manifest file contains a list of information about a website in a JSON format. This information is used to present the web app correctly for installation on a device.
131
183
132
-
In our example, we first create a file "helloworld-pwa.webmanifest" with the following content:
184
+
In our example, we first create a file "helloworld-pwa.json" with the following content:
133
185
134
186
```json
135
187
{
@@ -161,7 +213,7 @@ In our example, we first create a file "helloworld-pwa.webmanifest" with the fol
161
213
Then we include the file in the <head> block of the helloworld-pwa.html file:
In this article we took a look at how you can turn a simple barcode reading page into a PWA that is installable, re-engageable and capable of working offline. To learn more about Progressive web apps, you can click [here](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps).
277
+
In this article we took a look at how you can turn a simple barcode reading page into a PWA that is installable, re-engageable and capable of working offline. To learn more about Progressive web apps, you can click [here](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps).
278
+
279
+
## Support
280
+
281
+
If you have any questions, feel free to contact Dynamsoft support via [email](mailto:support@dynamsoft.com) or the "Chat" button in [homepage](https://www.dynamsoft.com/barcode-reader/sdk-javascript/).
0 commit comments