Javascript 如何配置iFrame打印的详细信息,如标题等

Javascript 如何配置iFrame打印的详细信息,如标题等,javascript,html,phaser-framework,Javascript,Html,Phaser Framework,我需要在phaser 3游戏中打印一个屏幕截图,我通过游戏快照功能中动态创建的iframe实现了这一点: this.game.renderer.snapshot(function(image){ var printframe = document.createElement('iframe'); printframe.style.display = "none"; printframe.setAttribute("id","printframe"); printf

我需要在phaser 3游戏中打印一个屏幕截图,我通过游戏快照功能中动态创建的iframe实现了这一点:

this.game.renderer.snapshot(function(image){
    var printframe = document.createElement('iframe');
    printframe.style.display = "none";
    printframe.setAttribute("id","printframe");
    printframe.setAttribute("name","printframe");
    document.body.appendChild(printframe);
    setTimeout(function(){
        printframe.contentWindow.document.body.innerHTML='<img src="'+image.src+'">';
        setTimeout(function(){
            window.frames["printframe"].print(); 
        }, 500);
},500)
this.game.renderer.snapshot(函数(图像){
var printframe=document.createElement('iframe');
printframe.style.display=“无”;
setAttribute(“id”、“printframe”);
setAttribute(“名称”、“打印框”);
document.body.appendChild(打印框);
setTimeout(函数(){
printframe.contentWindow.document.body.innerHTML='';
setTimeout(函数(){
window.frames[“printframe”].print();
}, 500);
},500)
})

现在可以了,但我已经打印了“about:blank”、页码和日期/时间。 如何更精确地配置它


谢谢

由于文档:,告诉我们“HTML内联框架元素()表示嵌套的浏览上下文,将另一个HTML页面嵌入到当前页面中。”。让iframe的内容成为一个完全限定的HTML文档怎么样?嗯,你的意思是添加一个合适的打印样式表吗?about:blank确实来自document.url,它是只读的。所以没有办法从JS中配置它。