回答編集履歴

2

chousei

2022/12/23 03:41

投稿

yambejp
yambejp

スコア114771

test CHANGED
@@ -10,3 +10,13 @@
10
10
  document.head.insertBefore(script,document.head.querySelector('script'));
11
11
  });
12
12
  ```
13
+ 調整
14
+ 上記若干調整してこんなふうでも良いかも
15
+ ```javascript
16
+ window.addEventListener('load',async()=>{
17
+ const script=Object.assign(document.createElement('script'),{
18
+ src:window.URL.createObjectURL(new Blob([await fetch('https://raw.githubusercontent.com/lot-uni/CDN/main/alert.js').then(res=>res.text())]))
19
+ });
20
+ document.head.insertBefore(script,document.head.querySelector('script'));
21
+ });
22
+ ```

1

chousei

2022/12/23 01:13

投稿

yambejp
yambejp

スコア114771

test CHANGED
@@ -1,2 +1,12 @@
1
1
  マイムタイプが一致しないというエラーが出ているようです
2
2
  - [X-Content-Type-Options - HTTP | MDN](https://developer.mozilla.org/ja/docs/Web/HTTP/Headers/X-Content-Type-Options#%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%86%E3%82%A3%E3%83%96)
3
+
4
+ 見た感じCORSには引っ駆らないようなのでどうしてもというのであればこんな感じで
5
+ ```javascript
6
+ window.addEventListener('load',async()=>{
7
+ const script=Object.assign(document.createElement('script'),{
8
+ textContent:await fetch('https://raw.githubusercontent.com/lot-uni/CDN/main/alert.js').then(res=>res.text())
9
+ });
10
+ document.head.insertBefore(script,document.head.querySelector('script'));
11
+ });
12
+ ```