【发布时间】:2015-10-21 21:43:30
【问题描述】:
我有一些代码来创建一个弹出窗口,写一些 html 并打印。谷歌浏览器没有在打印预览中显示图像,但其他浏览器工作正常。在我的情况下,文件Logo_big.png 丢失了。我怎样才能让它在 Chrome 中也能工作?
我的代码:
var newWindow = window.open('', '', 'width=100, height=100'),
document = newWindow.document.open(),
pageContent =
'<!DOCTYPE html>' +
'<html>' +
'<head>' +
'<meta charset="utf-8" />' +
'<title>Inventory</title>' +
'<style type="text/css">body {-webkit-print-color-adjust: exact; font-family: Arial; }</style>' +
'</head>' +
'<body><div><div style="width:33.33%; float:left;"><img src="img/Logo_big.png"/></body></html>';
document.write(pageContent);
document.close();
newWindow.moveTo(0, 0);
newWindow.resizeTo(screen.width, screen.height);
newWindow.print();
newWindow.close();
【问题讨论】:
标签: javascript google-chrome printing popup