testing tytd-web-share-target

This commit is contained in:
Mike Nolan 2022-01-03 14:33:20 -06:00
parent 865a75bf90
commit 277d0c732c
3 changed files with 28 additions and 2 deletions

View File

@ -6,6 +6,15 @@
"background_color": "#ff0000", "background_color": "#ff0000",
"description": "Download YouTube Videos", "description": "Download YouTube Videos",
"orientation": "portrait-primary", "orientation": "portrait-primary",
"share_target": {
"action": "./share",
"method": "GET",
"params": {
"title": "title",
"text": "text",
"url": "url"
}
},
"icons": [ "icons": [
{ {
"src": "assets/icons/icon-72x72.png", "src": "assets/icons/icon-72x72.png",

16
share/index.html Normal file
View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TYTD</title>
</head>
<body>
<h4 id="demi"></h4>
<script>
var element=document.getElementById('demi');
element= window.location.search;
</script>
</body>
</html>

5
sw.js
View File

@ -11,7 +11,8 @@ var urlsToCache = [
'./js/jquery.js', './js/jquery.js',
'./search.html', './search.html',
'./upload.html', './upload.html',
'./legacy.html' './legacy.html',
]; ];
self.addEventListener('install', function(event) { self.addEventListener('install', function(event) {
@ -26,7 +27,7 @@ self.addEventListener('install', function(event) {
}); });
self.addEventListener('fetch',function(event) { self.addEventListener('fetch',function(event) {
event.respondWith( event.respondWith(
caches.match(event.request) caches.match(event.request)
.then(function(response) { .then(function(response) {
// Cache hit - return response // Cache hit - return response