Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IE printing entire page instead of element #36

Open
buchannon opened this issue Mar 27, 2012 · 8 comments
Open

IE printing entire page instead of element #36

buchannon opened this issue Mar 27, 2012 · 8 comments

Comments

@buchannon
Copy link

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!

@erikzaadi
Copy link
Owner

I'll have a look.

Got a link to the problem by chance?

@buchannon
Copy link
Author

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
Copy link
Author

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..

@erikzaadi
Copy link
Owner

Thanks for the update..

@buchannon
Copy link
Author

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

@erikzaadi
Copy link
Owner

Thanks

@stevesum
Copy link

Maybey this is connected to the Issue 41
#41

@PJ-Github
Copy link

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

html.push('<script type="text/javascript">function printPage(){setTimeout(function(){focus();print();},2000);' + ((!$.browser.opera && !opts["leaveOpen"] && opts["printMode"].toLowerCase() == 'popup') ? 'close();' : '') + '}</script>');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants