Service worker

This commit is contained in:
Michel 2018-06-25 14:19:45 +02:00
parent 051ffd6163
commit 2a37361586
4 changed files with 9 additions and 8 deletions

View File

@ -9,6 +9,7 @@ composer require pixelspin/silverstripe-progressivewebapp
## Usage
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">)
Include the js (Requirements::javascript('pixelspin/silverstripe-progressivewebapp:resources/js/progressivewebapp.js');)

View File

@ -1,3 +1,3 @@
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('resources/pixelspin/silverstripe-progressivewebapp/resources/js/service-worker.js');
navigator.serviceWorker.register('/service-worker.js');
}

View File

@ -23,7 +23,7 @@ class ProgressiveWebAppController extends Controller {
$config = SiteConfig::current_site_config();
$manifestContent = [];
$manifestContent['start_url'] = './';
$manifestContent['start_url'] = '/';
if($config->ManifestName){
$manifestContent['name'] = $config->ManifestName;