erikzaadi / jQueryPlugins

Collection of jQuery plugins
83 stars 88 forks source link

PRINT ON IE8 AJAX CONTENT WITH IFRAME METHOD #13

Open erikzaadi opened 13 years ago

erikzaadi commented 13 years ago

Just noticed this on plugins.jquery.com

Submitted by aiecoucou on May 28, 2010 - 7:54pm

Project: jQuery Print Element

Version: 1.1

Component: Code

Category: bug report

Priority: normal

Assigned: Unassigned

Status: patch (code needs review)

I had some problems to print a content from ajax with iframe method, i found a solution mayby this can help you :

i replaced the line :

html.push('function printPage(){focus();print();' + ((!$.browser.opera && !opts.leaveOpen &&    opts.printMode.toLowerCase() == 'popup') ? 'close();' : '') + '}');

by this line :

html.push('function printPage(){focus();try { document.execCommand(\'print\', false, null); } catch(e) {window.print();}' + ((!$.browser.opera && !opts.leaveOpen && opts.printMode.toLowerCase() == 'popup') ? 'close();' : '') + '}');

it's seems to work for me...

cphill02 commented 13 years ago

I had this exact same issue with version 1.2 , This edit fixed it for me.

cphill02 commented 13 years ago

for reference: http://bytes.com/topic/misc/answers/629926-ie7-printing-iframe-solution