Chrome window.print() opening takes too long time

chromium, google-chrome, javascript

Solution

I found the cause. If in the background is running some extension, that makes post request. And this request have pending status about 30 sec. Only after it finishes print-dialogue appears. So pending request blocks print dialogue to be opened

Problem

I have modal dialog, with some text that should be printed, and print link. So when I press print, it takes me about 30 sec to open preview dialog in chrome(firefox, safari, ie are fine). What is the reason of that? dialog: ``` <div id="dialog"> <div id="to_print_data"> My data to print!!!!! </div> Click <a href="#" onclick="window.print(); return false;"> here</a> </div> <style> @media print { body * { visibility:hidden; } #to_print_data, #to_print_data * { visibility:visible; } #to_print_data { position:absolute; left:0!important; top:0!important; border:0!important; font-size:16px!important; } } </style> ``` UPDATE: I found cause, in the background running some script, that makes post request, and request have pending status about 30 sec, after it finished print-dialogue appears. How to prevent this behavior, when print waiting for post request to finish, without removing script?

Original source