mirror of
https://github.com/a2nt/silverstripe-progressivewebapp.git
synced 2024-10-22 11:05:45 +02:00
Service worker
This commit is contained in:
parent
051ffd6163
commit
2a37361586
@ -9,6 +9,7 @@ composer require pixelspin/silverstripe-progressivewebapp
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
Install the module, run dev/build and fill in the settings in the siteconfig
|
Install the module, run dev/build and fill in the settings in the siteconfig
|
||||||
|
Create a symlink at the root of you website to vendor/pixelspin/silverstripe-progressivewebapp/service-worker.js
|
||||||
Place the link to the manifest file (<link rel="manifest" href="{$BaseHref}manifest.json">) in the head of your pages and add the color meta data as well (<meta name="theme-color" content="$SiteConfig.ManifestColor">)
|
Place the link to the manifest file (<link rel="manifest" href="{$BaseHref}manifest.json">) in the head of your pages and add the color meta data as well (<meta name="theme-color" content="$SiteConfig.ManifestColor">)
|
||||||
Include the js (Requirements::javascript('pixelspin/silverstripe-progressivewebapp:resources/js/progressivewebapp.js');)
|
Include the js (Requirements::javascript('pixelspin/silverstripe-progressivewebapp:resources/js/progressivewebapp.js');)
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
if ('serviceWorker' in navigator) {
|
if ('serviceWorker' in navigator) {
|
||||||
navigator.serviceWorker.register('resources/pixelspin/silverstripe-progressivewebapp/resources/js/service-worker.js');
|
navigator.serviceWorker.register('/service-worker.js');
|
||||||
}
|
}
|
@ -23,7 +23,7 @@ class ProgressiveWebAppController extends Controller {
|
|||||||
|
|
||||||
$config = SiteConfig::current_site_config();
|
$config = SiteConfig::current_site_config();
|
||||||
$manifestContent = [];
|
$manifestContent = [];
|
||||||
$manifestContent['start_url'] = './';
|
$manifestContent['start_url'] = '/';
|
||||||
|
|
||||||
if($config->ManifestName){
|
if($config->ManifestName){
|
||||||
$manifestContent['name'] = $config->ManifestName;
|
$manifestContent['name'] = $config->ManifestName;
|
||||||
|
Loading…
Reference in New Issue
Block a user