是的,我也看到了与此相关的其他问题,但它们没有帮助我,所以这是我的代码。
$("#raspe4atat_<?= $ui->item_id ?>").click(function(){
$.ajax({
url: "/raspe4atat/<?= $ui->item_id ?>",
type: "GET",
success: function(){
$.ajax({
url: "/iframe/<?= $ui->item_id ?>",
type: "GET",
success: function(r){
$("#not_enough_money_<?= $ui->item_id ?>").append(r);
setTimeout(function(){
document.getElementById('pdf_<?= $ui->item_id ?>').contentWindow.print();
//window.frames['iframe_<?= $ui->item_id ?>'].print();
}, 1000);
}
});
}
});
return false;
});
这是 iframe:
<iframe name="iframe_<?= $ui->item_id ?>" style="position: absolute; top: -1000px;" id="pdf_<?= $ui->item_id ?>" src="<?= base_url().'pdf/'."coupon_info_".$ui->user_id.'.pdf' ?>" width="0" height="0">
</iframe>
此代码在 google chrome 中有效,但在 firefox 中无效。
首先它在服务器中创建pdf,然后在页面中生成,然后等待1秒然后打印它,但它在firefox中不起作用,如果我取消注释行,那么firefox会询问我是否要停止更多对话窗口?你能帮助我吗?
在我看来,您正在检查的浏览器将会过时,因为我已经在所有浏览器中检查了以下代码并且它工作正常。
我检查了 Chrome、Firefox 和 Opera,还检查了 IE,它在所有浏览器中都运行良好。
因此,请先更新您的浏览器。
window.frames['iframe_1'].focus();
window.frames['iframe_1'].print();
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)