开发者

Javascript: Print (to printer...) from var?

开发者 https://www.devze.com 2023-01-07 07:18 出处:网络
I have something like this on a $.ajax() success function: var popup = window.open(\'\',titulo,\"menubar=0,location=0,height=500,width=800\");

I have something like this on a $.ajax() success function:

var popup = window.open('',titulo,"menubar=0,location=0,height=500,width=800");
popup.document.write(response);
popup.print();

My problem is that some browsers block popups, and my only need is to print.

I've found jqPrint, it is a jQuery plugin that prints from elements using an iframe.

And I do not want to load another plugin... :/

Can anybody he开发者_开发百科lp me?

Thanks in advance


Maybe the fastest way is to inject the html into an hidden iFrame and print it's content.

0

精彩评论

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