P01yH3dr0n commited on
Commit
79d182c
1 Parent(s): 62b37d0

Create jsReloader.js

Browse files
Files changed (1) hide show
  1. jsReloader.js +8 -0
jsReloader.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ window.addEventListener("error", e => {
2
+ const tag = e.target
3
+ if (tag.tagName === 'SCRIPT' && !(e instanceof ErrorEvent)) {
4
+ console.log("JS 加载错误")
5
+ const url=new URL(tag.src)
6
+ document.write(`<script src="${url.toString()}">\<\/script>`);
7
+ }
8
+ }, true);