Last active
June 27, 2019 04:56
-
-
Save umamichi/53910aab3b81b9471029990545dd65ff to your computer and use it in GitHub Desktop.
PWA 入門 〜iOS SafariでPWAを体験するまで〜 2019年7月更新 ref: https://qiita.com/umamichi/items/0e2b4b1c578e7335ba20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- index.html --> | |
<html> | |
<head> | |
<title>github pages test</title> | |
</head> | |
<body> | |
<h1>github pages test</h1> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
あなたのユーザーネーム.github.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- index.html --> | |
<html> | |
<head> | |
<title>github pages test</title> | |
</head> | |
<body> | |
<h1>github pages test</h1> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "PWA Sample", | |
"short_name": "PWA", | |
"background_color": "#fc980c", | |
"icons": [{ | |
"src": "./icon-256.png", | |
"sizes": "256x256", | |
"type": "image/png" | |
},{ | |
"src": "./icon-192.png", | |
"sizes": "192x192", | |
"type": "image/png" | |
}], | |
"start_url": "./?utm_source=homescreen", | |
"display": "standalone" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"start_url": "./?utm_source=homescreen", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"display": "standalone" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// service-worker.js | |
self.addEventListener('install', function(e) { | |
console.log('[ServiceWorker] Install'); | |
}); | |
self.addEventListener('activate', function(e) { | |
console.log('[ServiceWorker] Activate'); | |
}); | |
// 現状では、この処理を書かないとService Workerが有効と判定されないようです | |
self.addEventListener('fetch', function(event) {}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- index.html --> | |
<html> | |
<head> | |
<!-- manifest.jsonを呼び出しています --> | |
<link rel="manifest" href="./manifest.json"> | |
<script> | |
// service workerが有効なら、service-worker.js を登録します | |
if ('serviceWorker' in navigator) { | |
navigator.serviceWorker.register('./service-worker.js').then(function() { console.log('Service Worker Registered'); }); | |
} | |
</script> | |
<title>Hello PWA.</title> | |
<style> | |
body { | |
text-align:center; | |
font-size: 40px; | |
vertical-align: middle; | |
} | |
.image { | |
width: 80%; | |
margin: auto; | |
display: block; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>Hello PWA.</h1> | |
<img src="./pwa-logo.svg" alt="PWA logo" class="image" /> | |
<a href="p.html">p.html</a> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// service-worker.js | |
self.addEventListener('install', function(e) { | |
console.log('[ServiceWorker] Install'); | |
}); | |
self.addEventListener('activate', function(e) { | |
console.log('[ServiceWorker] Activate'); | |
}); | |
// 現状では、この処理を書かないとService Workerが有効と判定されないようです | |
self.addEventListener('fetch', function(event) {}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- p.html --> | |
<html> | |
<head> | |
<title>Hello PWA. p.html</title> | |
<style> | |
body { | |
text-align:center; | |
font-size: 40px; | |
vertical-align: middle; | |
} | |
.image { | |
width: 80%; | |
margin: auto; | |
display: block; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>p.html</h1> | |
<img src="./p-chan.jpg" alt="p-chan" class="image" /> | |
<a href="index.html">index.html</a> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- p.html --> | |
<html> | |
<head> | |
<title>Hello PWA. p.html</title> | |
<style> | |
body { | |
text-align:center; | |
font-size: 40px; | |
vertical-align: middle; | |
} | |
.image { | |
width: 80%; | |
margin: auto; | |
display: block; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>p.html</h1> | |
<img src="./p-chan.jpg" alt="p-chan" class="image" /> | |
<a href="index.html">index.html</a> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<meta name="apple-mobile-web-app-capable" content="yes"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<meta name="apple-mobile-web-app-status-bar-style" content="black"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment