jQueryPlugins icon indicating copy to clipboard operation
jQueryPlugins copied to clipboard

IE printing entire page instead of element

Open buchannon opened this issue 13 years ago • 8 comments
trafficstars

Happening in both IE8 and IE9 for me (but not FF or Chrome).

On page load, I do an ajax call to get some data, then fill out a jQuery template with the data. Inside of the template (meaning that the template has to load with data before the print link even shows) there is a link that calls the printElement() function on the containing div of the template.

I can do an alert on the containing div before printElement() and it shows the correct HTML, however when printElement() fires and I click to print, it just does the entire page.

Any ideas? Thanks!

buchannon avatar Mar 27 '12 21:03 buchannon

I'll have a look.

Got a link to the problem by chance?

erikzaadi avatar Mar 28 '12 13:03 erikzaadi

Not one that I can share unfortunately, no. It's just interesting that I can correctly alert the correct innerHTML of the div I want to print, but then it errors on printing in IE only. I'll try a few more tricks and let you know if I come up with a workaround.

buchannon avatar Mar 28 '12 15:03 buchannon

I'm pretty stumped on this one. I created a really simple "testing printing" element outside of the main content area and it's still trying to print the entire page in IE 8 and IE9.

I'm now thinking this may be a problem with https versus http though, as I can run it locally on the same database with http and it will print the element fine. However in my other environment which uses SSL, it errors and prints the entire page. Will continue investigating this..

buchannon avatar Mar 28 '12 17:03 buchannon

Thanks for the update..

erikzaadi avatar Mar 29 '12 15:03 erikzaadi

Just FYI - I wasn't able to figure out what was going on with your plugin. However, the following "print element" solution works for me in all instances so we have switched over to that:

http://www.bennadel.com/blog/1591-Ask-Ben-Print-Part-Of-A-Web-Page-With-jQuery.htm

buchannon avatar Apr 05 '12 17:04 buchannon

Thanks

erikzaadi avatar Apr 05 '12 19:04 erikzaadi

Maybey this is connected to the Issue 41 https://github.com/erikzaadi/jQueryPlugins/issues/41

stevesum avatar Sep 19 '12 09:09 stevesum

I was able to fix this issue by surrounding the call to the focus and print methods with a set timeout.

html.push('');

PJ-Github avatar Feb 26 '13 00:02 PJ-Github