Files
TankIC/3DTank/tools/probe_legacy_iframe.js

17 lines
617 B
JavaScript

// 测试:在我们的页面里注入原版客户端 iframe,看看是否能正常渲染。
(async () => {
const f = document.createElement('iframe');
f.src = 'http://localhost:8081/#nohornet';
f.style.cssText =
'position:fixed;inset:0;width:100%;height:100%;z-index:99999;border:0;background:#000';
document.body.appendChild(f);
await new Promise((r) => setTimeout(r, 12000));
let text = 'cross-origin';
try {
text = f.contentDocument && f.contentDocument.body
? f.contentDocument.body.innerText.slice(0, 200)
: 'no-doc';
} catch (e) {}
return { hasFrame: true, text };
})()