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: docs/README.md
+20-4Lines changed: 20 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,21 @@ UpUp can only serve offline content for requests within its scope. The scope is
29
29
30
30
This means that if you placed the files in your `/js/` directory, UpUp will only be able to show your offline content when users try to look inside the `/js/` directory.
31
31
32
-
**This is why you should always place the script as close to the root of your site as possible (e.g. https://www.talater.com/upup.min.js).**
32
+
**This is why you should almost always place the script as close to the root of your site as possible (e.g. https://www.talater.com/upup.min.js).**
33
+
34
+
#### Scope - Advanced
35
+
It is possible to keep `upup.min.js` outside the scope (e.g. in a CDN), as long as `upup.sw.min.js` is kept local (that file's location determines the scope).
36
+
If you choose to keep the two in separate directories, make sure to pass the `service-worker-url`[setting](https://github.com/TalAter/UpUp/tree/master/docs#settings).
@@ -45,9 +59,11 @@ same settings object directly to the start() method.
45
59
UpUp.start({ content: 'Cannot reach site. Please check your internet connection.' });
46
60
47
61
The settings object supports the following options:
48
-
-`content-url` (String) The content to display when user is offline (url to the content that will be served)
49
-
-`content` (String) The content to display when user is offline (plain text, HTML, etc.)
50
-
-`assets` (Array) Array of assets to cache for offline access
62
+
-`content-url` (String) The content to display when user is offline (url to the content that will be served)
63
+
-`content` (String) The content to display when user is offline (plain text, HTML, etc.)
64
+
-`assets` (Array) Array of assets to cache for offline access
65
+
-`service-worker-url` (String) The url to the service worker file (`upup.sw.min.js`)
66
+
Allows loading `upup.min.js` from a CDN while `upup.sw.min.js` stays local (see [scope](https://github.com/TalAter/UpUp/blob/master/docs/README.md#scope))
Copy file name to clipboardExpand all lines: src/upup.js
+20-4Lines changed: 20 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,21 @@
35
35
*
36
36
* This means that if you placed the files in your `/js/` directory, UpUp will only be able to show your offline content when users try to look inside the `/js/` directory.
37
37
*
38
-
* **This is why you should always place the script as close to the root of your site as possible (e.g. https://www.talater.com/upup.min.js).**
38
+
* **This is why you should almost always place the script as close to the root of your site as possible (e.g. https://www.talater.com/upup.min.js).**
39
+
*
40
+
* #### Scope - Advanced
41
+
* It is possible to keep `upup.min.js` outside the scope (e.g. in a CDN), as long as `upup.sw.min.js` is kept local (that file's location determines the scope).
42
+
* If you choose to keep the two in separate directories, make sure to pass the `service-worker-url` [setting](https://github.com/TalAter/UpUp/tree/master/docs#settings).
* The settings object supports the following options:
55
-
* - `content-url` (String) The content to display when user is offline (url to the content that will be served)
56
-
* - `content` (String) The content to display when user is offline (plain text, HTML, etc.)
57
-
* - `assets` (Array) Array of assets to cache for offline access
69
+
* - `content-url` (String) The content to display when user is offline (url to the content that will be served)
70
+
* - `content` (String) The content to display when user is offline (plain text, HTML, etc.)
71
+
* - `assets` (Array) Array of assets to cache for offline access
72
+
* - `service-worker-url` (String) The url to the service worker file (`upup.sw.min.js`)
73
+
* Allows loading `upup.min.js` from a CDN while `upup.sw.min.js` stays local (see [scope](https://github.com/TalAter/UpUp/blob/master/docs/README.md#scope))
0 commit comments