この Blog をmanifest.json
を
manifest.json
は
danethurber/webpack-manifest-plugin: webpack plugin for generating asset manifests
一通り、webpack.config.js
をlighthouse
で
Contains Some Content When JavaScript Is Not Available
Does not redirect HTTP traffic to HTTPS
Does not respond with a 200 when offline
Page load is not fast enough on 3G
User will not be prompted to Install the Web App
Address bar does not match brand colors
上記、
参考
Address Bar Matches Brand Colors | Tools for Web Developers | Google Developers
ページで
スクリプトが 利用できない 場合に 表示する コンテンツを 用意する | Tools for Web Developers | Google Developers
対処方法 2018年2月
Contains Some Content When JavaScript Is Not Available
JavaScript が
SPA
html に
<noscript> <div id='noscript_warning'>当サイトを閲覧する場合は、JavaScript を有効化してください。</div> </noscript>
Does not respond with a 200 when offline
Offline の
確かに
作り
Page load is not fast enough on 3G
3G回線の
広告を
User will not be prompted to Install the Web App
ユーザーに
manifest.json
の
start_url の
記載を 変更する。
start_url
を以下のように 記載を していました。 このstart_url: "https://www.monotalk.xyz/?utm_source=homescreen",
記載の クエリストリングが よくないと 考え、 以下の 記載に 変更しました。 再度、start_url: "https://www.monotalk.xyz/",
監査を 実行してみましたが、 特に 警告の 内容に 変化は ありませんでした。 start_url を
動的Cache に 追加する。
start_url がオフライン時の Cache と して 設定されていないのが 原因と 考え、 ドメイン直下を 動的 Cache と して 追加してみました。
Cache には、Workbox | Tools for Web Developers | Google Developers を 使用して おり、 以下の 記載を 追加しました。 監査をworkboxSW.router.registerRoute(/\/$|\/\?utm_source.+$|\/?page=.+$/, workboxSW.strategies.networkFirst({ "cacheName": "root", "cacheExpiration": { "maxAgeSeconds": 60 * 60 * 24 * 10, "maxEntries": 1 } }), "GET");
実行した ところ、 警告が 消え、 Does not respond with a 200 when offline
も芋づる 式に 出力されなくなりました。
Address bar does not match brand colors
アドレスバーのmanifest.json
で
これは、theme-color
を
manifest.json で"#808080"
なので、
<meta name="theme-color" content="#808080"/>
manifest.json
のみの
追記 2019年5月
上記の
変更点と
start_url
には 相対 URL を 記載する。
Web App Manifest | MDN に
The URL that loads when a user launches the application (e.g. when added to home screen), typically the index. Note that this has to be a relative URL, relative to the manifest url.
start_url
は
以前は、
Current page responds with a 200 when offline
、start_url responds with a 200 when offline
に ついて
前回の
Workbox の
正規表現の
workbox.routing.registerRoute(new RegExp('(/$|/\?utm_source.+$)'), workbox.strategies.networkFirst({ cacheName: 'root', plugins: [ new workbox.expiration.Plugin({ maxAgeSeconds: 60 * 60 * 24 * 10, maxEntries: 10, }), ], }), 'GET'); workbox.routing.registerRoute(new RegExp('/\?page=.+$'), workbox.strategies.networkFirst({ cacheName: 'pages', plugins: [ new workbox.expiration.Plugin({ maxAgeSeconds: 60 * 60 * 24 * 10, maxEntries: 10, }), ], }), 'GET');
new RegExp('/\?page=.+$')
をnew RegExp('^/\?page=.+$')
と
参考
以下、
- [Rails] Lighthouseで
PWAスコア100点を とる ために やったこと - Qiita - “URL responds with a 200 when offline”: initial URL or final URL? · Issue #715 · GoogleChrome/lighthouse
- Service worker does not successfully serve the manifest’s start_url. · Issue #4541 · GoogleChrome/lighthouse
- ウェブアプリ マニフェスト | Web | Google Developers
以上です。
コメント