回答編集履歴

1

サンプル追加

2017/03/19 17:55

投稿

lazex
lazex

スコア604

test CHANGED
@@ -3,3 +3,41 @@
3
3
 
4
4
 
5
5
  safari 使えないので試してはいません
6
+
7
+
8
+
9
+ ---
10
+
11
+ 追記
12
+
13
+
14
+
15
+ サンプルです。
16
+
17
+ そのドメインのルートの html ファイルを保存する例です。
18
+
19
+ ```javascript
20
+
21
+ fetch("/")
22
+
23
+ .then(e => e.arrayBuffer())
24
+
25
+ .then(result => {
26
+
27
+ const binary_str = Array.from(new Uint8Array(result), e => String.fromCharCode(e)).join("")
28
+
29
+ const base64 = btoa(binary_str)
30
+
31
+ const datauri = `data:application/octet-stream;base64,${base64}`
32
+
33
+ window.open(datauri)
34
+
35
+ })
36
+
37
+ ```
38
+
39
+
40
+
41
+ Chrome では動きますが、safariの実行環境はないので試してません。
42
+
43
+