瀏覽代碼

apple meta tags & service-worker events listening

master
Flo Smilari 4 年之前
父節點
當前提交
1fbea76d6a
共有 3 個檔案被更改,包括 24 行新增4 行删除
  1. 10
    2
      wwwroot/index.html
  2. 2
    2
      wwwroot/manifest.json
  3. 12
    0
      wwwroot/service-worker.js

+ 10
- 2
wwwroot/index.html 查看文件

<link href="css/united/_variables.min.css" rel="stylesheet" /> <link href="css/united/_variables.min.css" rel="stylesheet" />
<link href="css/app.css" rel="stylesheet" /> <link href="css/app.css" rel="stylesheet" />
<link href="manifest.json" rel="manifest" /> <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> </head>
<body> <body>
<a class="dismiss">🗙</a> <a class="dismiss">🗙</a>
</div> </div>
<script src="_framework/blazor.webassembly.js"></script> <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> <script>
function BlazorSetLocalStorage(key, value) { function BlazorSetLocalStorage(key, value) {
localStorage.setItem(key, value); localStorage.setItem(key, value);

+ 2
- 2
wwwroot/manifest.json 查看文件

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

+ 12
- 0
wwwroot/service-worker.js 查看文件

// In development, always fetch from the network and do not enable offline support. // 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 // This is because caching would make development more difficult (changes would not
// be reflected on the first load after each change). // 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', () => { }); self.addEventListener('fetch', () => { });

Loading…
取消
儲存