blob: dc743cdc673d6ed671cf111faf699aeb2cbd04fe (
plain)
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
|
<script>
let keepAlive;
window.onpageshow = (pageShow) => {
let bc = new BroadcastChannel("bfcache_blocking");
bc.onmessage = async function(m) {
switch(m.data.message) {
case "load":
bc.close();
location.href = m.data.url;
break;
case "runScript":
let test = new Function(`return ${m.data.fun};`)();
keepAlive = await test.call(window);
bc.postMessage({ type: "runScriptDone" });
break;
case "back":
bc.close();
history.back();
break;
case "forward":
bc.close();
history.forward();
break;
case "close":
window.close();
break;
}
};
bc.postMessage({ type: pageShow.type, persisted: pageShow.persisted })
};
</script>
|