-
Notifications
You must be signed in to change notification settings - Fork 0
/
sitemap1.html
36 lines (31 loc) · 1.19 KB
/
sitemap1.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
27
28
29
30
31
32
33
34
35
36
<!DOCTYPE html>
<html>
<head>
<title>File Download and Deletion</title>
</head>
<body>
<h1>Download and Delete File</h1>
<button onclick="createAndDownloadFile()">Create and Download File</button>
<script>
function createAndDownloadFile() {
// Create a Blob with some content (e.g., a text file)
const fileContent = 'This is the content of the file.';
const blob = new Blob([fileContent], { type: 'text/plain' });
// Create a temporary download link
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'sitemap.txt';
// Trigger a click event to initiate the download
a.style.display = 'none';
document.body.appendChild(a);
a.click();
// Remove the temporary download link
document.body.removeChild(a);
// You can't automatically delete the file due to security restrictions
// Instruct the user to manually delete the file
alert('File has been downloaded. Please manually delete it when done.');
}
</script>
</body>
</html>