开发者

Sending to the printer the content of an url

I know that I can print the current page by calling

javascript:windows.print()

Is it possible to print a page without showing it first? I mean if I have a link I would like to send to the printer the content of the target_url.

<a href="target_url">Click to print the target_url</a>

I can load it with ajax, but there's anyway to send this content to the p开发者_如何学JAVArinter?

Thanks.


What about using an iframe? Load the contents in an iframe that is not visible and then print the iframe.


You could load your content into a hidden frame and then have it call window.print(). That will result in the browser's native "Print" dialog being shown to the user. You cannot force the client machine to start printing something without user approval.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜