Source code

Revision control

Copy as Markdown

Other Tools

<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title></title>
<script>
'use strict';
const params = new URL(location).searchParams;
const bc = new BroadcastChannel(params.get('channel_name'));
const win = open(params.get('resource'), params.get('resource_name'));
bc.onmessage = () => {
win.close();
close();
};
const id = setInterval(() => {
if (win.closed || win.location.href !== 'about:blank') {
clearInterval(id);
const winName = (() => {
try {
return win.name;
} catch (e) {
return null;
}
})();
bc.postMessage({name: winName || null, closed: win.closed});
}
}, 100);
</script>