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
<html> | |
<head> | |
<title>Test</title> | |
</head> | |
<body> | |
<p> | |
This page will make a CORS-enabled request for <code>https://cors-test.appspot.com/test</code> with an | |
Authentication header set after the service worker takes control. | |
</p> |
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
<html> | |
<body> | |
<script src="https://cdn.rawgit.com/jakearchibald/indexeddb-promised/dd48c031e7f93d6695e89bb504cbe586dfacc073/lib/idb.js"></script> | |
<script> | |
idb.open('test', 1).then(db => { | |
db.transaction('key-val').objectStore('key-val').put('hello', 'world'); | |
}); | |
</script> | |
</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
<html> | |
<body> | |
<video controls src="https://cdn.rawgit.com/dominikhlbg/vp8-webm-javascript-decoder/master/webm/The_Google_Story.webm"></video> | |
<script> | |
navigator.serviceWorker.register('sw.js'); | |
</script> | |
</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
<html> | |
<head> | |
<title>Test</title> | |
</head> | |
<body> | |
<script> | |
if ('serviceWorker' in navigator) { | |
navigator.serviceWorker.register('sw.js'); | |
navigator.serviceWorker.ready.then(() => { |
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
<html> | |
<head> | |
<title>Another Page</title> | |
</head> | |
<body> | |
<p>This is another page.</p> | |
<script> | |
if ('serviceWorker' in navigator) { | |
navigator.serviceWorker.register('sw.js'); | |
} |
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
<html> | |
<head> | |
<title>One</title> | |
</head> | |
<body> | |
<a href="two.html">Two</a> | |
<script> | |
navigator.serviceWorker.register('sw.js'); | |
</script> | |
</body> |
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
<html> | |
<head> | |
<title>Cross Origin Test</title> | |
</head> | |
<body> | |
<script> | |
navigator.serviceWorker.register('sw.js'); | |
</script> | |
</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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>IndexedDB Test</title> | |
</head> | |
<body> | |
<script> | |
var indexedDBOpenRequest = indexedDB.open('test', 1); |
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
/* | |
Copyright 2016 Google Inc. All Rights Reserved. | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software | |
distributed under the License is distributed on an "AS IS" BASIS, | |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
See the License for the specific language governing permissions and |
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
const CACHE_NAME = 'my-cache'; // Or whatever your cache is. | |
let urls = []; // An array of full, absolute URLs that may or may not be cached. | |
caches.open(CACHE_NAME) | |
.then(cache => cache.keys()) | |
.then(responses => responses.map(response => response.url)) | |
.then(urlsInCache => Promise.all(urls.map(url => { | |
return { | |
url: url, | |
cached: urlsInCache.includes(url) |