没有URL和日期时间使用JavaScript打印页面 [英] Print page without URL and DateTime Using Javascript

查看:228
本文介绍了没有URL和日期时间使用JavaScript打印页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过以下code打印由JavaScript div标签的内容。

I want to print the div tag content by javascript by using the following code.

var divToPrint1 = $('#PrintDoc').html();
var newWin = window.open('Share Certificate #001', '', 'width=10px,height=10px');
newWin.document.open();
newWin.document.write('<html><body onload="window.print();">' + divToPrint1 + '</body></html>');
newWin.document.close();
setTimeout(function () { newWin.close(); }, 10);

和打印code正常工作。但现在我想通过使用JavaScript code删除从打印的网址,日期和标题。
可能吗?
谁能帮我解决以下问题?

And print code works fine. But now I want to remove the url, date and title from the print by using the javascript code. Is it possible? Can anyone help me to solve the following problem?

推荐答案

您不能删除URL和时间戳编程。这些选项是打印对话框,不能从JavaScript页​​面进行控制的一部分。这种选择完全取决于用户。

You cannot remove the URL and timestamp programmatically. Those options are part of the Print dialog, which cannot be controlled from JavaScript in the page. This choice is entirely up to the user.

这篇关于没有URL和日期时间使用JavaScript打印页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆