Source code

Revision control

Copy as Markdown

Other Tools

<!doctype html>
<html>
<script src="/common/get-host-info.sub.js"></script>
<script>
function remote(path) {
const REMOTE_ORIGIN = get_host_info().HTTPS_REMOTE_ORIGIN;
return new URL(path, REMOTE_ORIGIN);
}
let params = new URLSearchParams(location.search);
let token = params.get('token');
let revalidate = params.get('revalidate');
let image_path = `/html/cross-origin-embedder-policy/resources/corp-image.py?token=${token}&revalidate=${revalidate}`;
window.addEventListener("load", async () => {
await new Promise(resolve => {
let img = document.createElement("img");
img.src = remote(image_path);
img.onload = () => { window.parent.postMessage({corp: false, loaded: true}, "*"); resolve(); };
img.onerror = (e) => { window.parent.postMessage({corp: false, loaded: false}, "*"); resolve(); };
document.body.appendChild(img);
});
await new Promise(resolve => {
let img = document.createElement("img");
img.src = remote(image_path + "&corp-cross-origin=1");
img.onload = () => { window.parent.postMessage({corp: true, loaded: true}, "*"); resolve(); };
img.onerror = (e) => { window.parent.postMessage({corp: true, loaded: false}, "*"); resolve(); };
document.body.appendChild(img);
});
window.parent.postMessage({done: true}, "*")
});
</script>
</html>