-
Notifications
You must be signed in to change notification settings - Fork 4
/
loadsw.js
44 lines (40 loc) · 1.09 KB
/
loadsw.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
async function loadsw(){
try {
await registerSW();
} catch (err) {
alert(err.toString());
throw err;
}
const url = search("", "");
var iframe = document.createElement('iframe');
iframe.style.position = "absolute";
iframe.style.width = "100%";
iframe.style.height = "100%";
iframe.style.top = "0px";
iframe.style.left = "0px";
iframe.style.display="none";
iframe.id = "iframe";
iframe.style.zIndex="9999999999999999";
iframe.style.border = "none";
iframe.src = __uv$config.prefix + __uv$config.encodeUrl(url);
document.body.appendChild(iframe);
function inIframe () {
try {
return window.self !== window.top;
} catch (e) {
return true;
}
}
function wait(){
if (window.location.href.includes("/service/")){
if (inIframe()){
parent.location.reload();
}
else{
window.location.reload(1);
}
}
}
setTimeout(wait,100);
}
loadsw();