jQueryPlugins
jQueryPlugins copied to clipboard
IE printing entire page instead of element
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!
I'll have a look.
Got a link to the problem by chance?
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.
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..
Thanks for the update..
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
Thanks
Maybey this is connected to the Issue 41 https://github.com/erikzaadi/jQueryPlugins/issues/41
I was able to fix this issue by surrounding the call to the focus and print methods with a set timeout.
html.push('');