jQueryPlugins icon indicating copy to clipboard operation
jQueryPlugins copied to clipboard

Prints a blank page in Google Chrome Browser

Open timdawg opened this issue 14 years ago • 8 comments

When using Google Chrome, this plugin prints a blank page. It seems that the printPage function is being called before Google Chrome has finished rendering the page.

The solution I found is to add a setTimeout to element["printPage"](); (line 105) in the _CallPrint function. The resulting code would look like this:

setTimeout(function () {
    element["printPage"]();
}, 50);

timdawg avatar Sep 17 '10 12:09 timdawg

What version of chrome are you using, and on what OS?

erikzaadi avatar Sep 21 '10 08:09 erikzaadi

edit: okay, it seems as if IE doesn't like it that way :(

first of all, thank you for the great work! i'm also having the this bug with google chrome. setTimeout also did the trick for me, but i had to set it to 300ms (or more if a lot of pictures have to be loaded): function _callPrint(element) { setTimeout(function () { _callPrint(element); }, 300); } the if and else in printElement v1.2 are, unfortunately, useless. Chrome seems to call print immediately after opening the popup window, without waiting for the content to be loaded. for the record i was using Chrome 5.0.375.99 on Mac OS X 10.6 i've also tried it with the newest version 7.0.517.41. there it even got worse, no print popup at all. but the method posted above still works! thanks for that

pinchbeck avatar Nov 02 '10 17:11 pinchbeck

Thanks, I'll have a look..

erikzaadi avatar Nov 02 '10 18:11 erikzaadi

It works fine in IE 8.0 on Windows XP for me. What version of IE are you using?

I just noticed that in Chrome 7.0.517.41, at 50ms it does not display the print popup. I increased it to 500ms.

The new code looks like this:

setTimeout(function () {
    element["printPage"]();
}, 500);

timdawg avatar Nov 02 '10 18:11 timdawg

I don't think the timeout fix is a good technique; imagine I have a big image that could'nt make it loading befor the timeout is over, it wo'nt print or only half of it will be printed.

so the solution is don't process the print until the document has finished loading; but how?! :)

numediaweb avatar May 12 '11 13:05 numediaweb

hello,

I a noob in these things. I can see whats it all about but I cant change anything cos i dont know the skills.

Is there any way to set a rule in as a option to send the print page also to an email adress? or mail instead to print?

thx

crofftt avatar Aug 04 '11 15:08 crofftt

@crofftt Mailing the entire page is a bit beyond the scope of a jQuery plugin I'm afraid. The only option to do something like that on the client side would be with a mailto link.

Have a looksie at http://webdesign.about.com/od/beginningtutorials/a/aabegin100299.htm and http://en.wikipedia.org/wiki/Mailto .

Usually sending such a mail is a server side task.

erikzaadi avatar Aug 04 '11 20:08 erikzaadi

Hey erikzaadi,

Thanks for quick respons. I know some of html. but this case I bought some coffeecup software to make a store. they use only paypall and something off .net...whatever. but in europe paypall isn't that famous.

so they can print there shopwagon and then you have to ask them to send it to me...that aint working. thats why the question of a email option. the page is verry small and light so thats not such a problem for sending.

the reason i ask it over here is because i saw that they use your script to print the page. thx anyway !

greetz

crofftt avatar Aug 05 '11 08:08 crofftt