soiz commited on
Commit
86f7e66
·
verified ·
1 Parent(s): 1dbe8dc

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +6 -1
index.html CHANGED
@@ -17,13 +17,18 @@
17
  event.preventDefault(); // デフォルトのリンク動作をキャンセル
18
  const blobUrl = link.href;
19
 
20
- const fixedName = "file.html"; // 固定ファイル名
21
 
22
  try {
23
  const response = await fetch(blobUrl);
24
  if (!response.ok) throw new Error(`HTTPエラー: ${response.status}`);
25
  const blob = await response.blob();
26
 
 
 
 
 
 
27
  // ファイル保存ダイアログを表示
28
  const handle = await window.showSaveFilePicker({
29
  suggestedName: fixedName,
 
17
  event.preventDefault(); // デフォルトのリンク動作をキャンセル
18
  const blobUrl = link.href;
19
 
20
+ let fixedName = "file.html"; // 固定ファイル名
21
 
22
  try {
23
  const response = await fetch(blobUrl);
24
  if (!response.ok) throw new Error(`HTTPエラー: ${response.status}`);
25
  const blob = await response.blob();
26
 
27
+ // ファイル名の拡張子確認と修正
28
+ if (!fixedName.endsWith('.html')) {
29
+ fixedName += '.html'; // 必要に応じて拡張子を付加
30
+ }
31
+
32
  // ファイル保存ダイアログを表示
33
  const handle = await window.showSaveFilePicker({
34
  suggestedName: fixedName,