View index.json
"prefer_related_applications": true,
"related_applications": [
{
"platform": "play",
"id": "com.google.samples.apps.iosched"
}
]
View index.json
"related_applications": [
{
"platform": "play",
"id": "com.google.samples.apps.iosched"
}
]
View index.js
window.addEventListener('beforeinstallprompt', function(e) {
e.userChoice.then(function(choiceResult) {
if(choiceResult.outcome == 'dismissed') {
console.log('User cancelled home screen install');
}
else {
console.log('User added to home screen');
}
});
});
View index.js
btnSave.addEventListener('click', function() {
if(deferredPrompt !== undefined) {
// インストールプロンプト表示
deferredPrompt.prompt();
deferredPrompt.userChoice
.then(function(choiceResult) {
// キャンセルされた場合
if(choiceResult.outcome == 'dismissed') {
console.log('User cancelled home screen install');
} else {
View index.js
var deferredPrompt;
window.addEventListener('beforeinstallprompt', function(e) {
e.preventDefault();
// ここでプロンプトを変数に入れておく
deferredPrompt = e;
return false;
});
View index.json
"start_url": "index.html?launcher=true"
View index.json
"start_url": "/?utm_source=homescreen"
View index.json
{
"display": "standalone",
"short_name": "hifiveTodo",
"name": "hifiveTodo",
"orientation": "portrait",
"icons": [
{
"src": "launcher-icon-1x.png",
"type": "image/png",
"sizes": "48x48"
View index.html
<link rel="manifest" href="/manifest.json">
View index.js
self.addEventListener('install', e => {
// インストール時に実行
e.waitUntil(
caches.open('mismith').then(cache => {
return cache.addAll([
'/',
'/client.js',
'/style.css'
])
.then(() => self.skipWaiting());