-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
26 lines (25 loc) · 819 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<html>
<head></head>
<body>
<script>
// Register Service Worker
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/service-worker.js');
});
}
function download() {
// Get values from inputs
const url = window.target_url.value;
const filename = window.filename.value;
const a = document.createElement('a');
a.href = `/swdonwload?url=${encodeURIComponent(url)}&filename=${filename}`;
a.target = '_blank';
a.click();
}
</script>
<input type="text" id="target_url" placeholder="URL" size="100"><br>
<input type="text" id="filename" placeholder="File name"><br>
<button onclick="download()">Download</button>
</body>
</html>