There are 2 files: index.html
and print.html
First one contains a button that opens print.html
using simple command:
window.open("print.html", "_blank", "menubar=yes,toolbar=yes,status,scrollbars,resizable");
print.html
contains only one button that opens print preview dialog:
<button onclick="window.print();">
The problem appears when print preview dialog is opened. In this case any action on index.html
- i.e. the other file that initiate ajax request - is temporary blocked and put into queue. And only when preview is closed browser fires all requests.
I can see it only in Google Chrome (24.0.1312.52 m).
Can anybody confirm that this is Chrome's bug?
If your Chromebook can't load the print preview, restart your laptop, printer, and router. Additionally, remove and set up the printer again. If the issue persists, clear your Chrome cache, and disable your extensions. You can also reset your browser to default settings.
ajax has async property. If you set it to false it will block.
New! Save questions or answers and organize your favorite content. Learn more.
there is a Chrome bug where window.print()
does not work when there is a tag in the DOM. It might be solved by calling this function:
function printPage() {
window.print();
//workaround for Chrome bug - https://code.google.com/p/chromium/issues/detail?id=141633
if (window.stop) {
location.reload(); //triggering unload (e.g. reloading the page) makes the print dialog appear
window.stop(); //immediately stop reloading
}
return false;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With