Browse Source

apple meta tags & service-worker events listening

master
Flo Smilari 4 years ago
parent
commit
1fbea76d6a
3 changed files with 24 additions and 4 deletions
  1. 10
    2
      wwwroot/index.html
  2. 2
    2
      wwwroot/manifest.json
  3. 12
    0
      wwwroot/service-worker.js

+ 10
- 2
wwwroot/index.html View File

@@ -16,7 +16,9 @@
<link href="css/united/_variables.min.css" rel="stylesheet" />
<link href="css/app.css" rel="stylesheet" />
<link href="manifest.json" rel="manifest" />
<link rel="apple-touch-icon" sizes="512x512" href="icon-512.png" />
<link rel="apple-touch-icon" sizes="96x96" href="/icons/icon-96.png" />
<meta name="apple-mobile-web-app-status-bar" content="#db001b">
<meta name="theme-color" content="#db001b">
</head>
<body>
@@ -29,7 +31,13 @@
<a class="dismiss">🗙</a>
</div>
<script src="_framework/blazor.webassembly.js"></script>
<script>navigator.serviceWorker.register('service-worker.js');</script>
<script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('service-worker.js')
.then((reg) => console.log('Service worker registered.', reg))
.catch((err) => console.log('Failed to registe Service worker.', err));
}
</script>
<script>
function BlazorSetLocalStorage(key, value) {
localStorage.setItem(key, value);

+ 2
- 2
wwwroot/manifest.json View File

@@ -1,9 +1,9 @@
{
"name": "CaritasPWA",
"name": "Caritas PWA",
"short_name": "CaritasPWA",
"start_url": "./",
"display": "standalone",
"background_color": "#ffffff",
"background_color": "#db001b",
"theme_color": "#db001b",
"orientation": "portrait-primary",
"icons": [

+ 12
- 0
wwwroot/service-worker.js View File

@@ -1,4 +1,16 @@
// In development, always fetch from the network and do not enable offline support.
// This is because caching would make development more difficult (changes would not
// be reflected on the first load after each change).
// install event
self.addEventListener('install', evt => {
console.log("Service-Worker has been installed.");
});
// activate event
self.addEventListener('activate', evt => {
console.log("Service-Worker has been activated.");
});
self.addEventListener('fetch', () => { });

Loading…
Cancel
Save