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

I have something like this in the success function $.ajax():

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 pop-ups and I can only print.
I found jqPrint , it is a jQuery plugin that prints from elements using iframe.

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

Can someone help me?

Thanks in advance

+3
source share
1 answer

Perhaps the fastest way is to insert the html into the hidden iFrame and print it.

+6
source

Source: https://habr.com/ru/post/1754592/


All Articles