soiz commited on
Commit
4c64058
·
verified ·
1 Parent(s): e3d57b0

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +34 -18
index.html CHANGED
@@ -1,19 +1,35 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="ja">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>HTMLを入力して新しいタブに表示</title>
6
+ </head>
7
+ <body>
8
+ <h1>HTMLを入力して新しいタブに表示する</h1>
9
+
10
+ <!-- HTML入力用テキストエリア -->
11
+ <textarea id="htmlInput" rows="10" cols="50" placeholder="ここにHTMLを入力してください"></textarea><br>
12
+
13
+ <!-- ボタン -->
14
+ <button onclick="openNewTabWithHTML()">新しいタブで表示</button>
15
+
16
+ <script>
17
+ function openNewTabWithHTML() {
18
+ // 入力されたHTMLを取得
19
+ const htmlContent = document.getElementById("htmlInput").value;
20
+
21
+ // 新しいタブを開く
22
+ const newTab = window.open("about:blank", "_blank");
23
+
24
+ if (newTab) {
25
+ // 新しいタブのドキュメントにHTMLを挿入
26
+ newTab.document.open();
27
+ newTab.document.write(htmlContent);
28
+ newTab.document.close();
29
+ } else {
30
+ alert("新しいタブを開けませんでした。ポップアップブロッカーを無効にしてください。");
31
+ }
32
+ }
33
+ </script>
34
+ </body>
35
  </html>