RESOLVED CONFIGURATION CHANGED 192585
iFrame printing works in desktop Safari, but not mobile...
https://bugs.webkit.org/show_bug.cgi?id=192585
Summary iFrame printing works in desktop Safari, but not mobile...
Lou Mazz
Reported 2018-12-11 03:08:50 PST
Printing. Works for me on desktop Safari. Same code won’t work on iOS Safari. Not a lot of code: =================================== //"Print" order button on orderItemList page $('#orderItemList .toolbar .printButton').live('click', function(event) { //test for pending (Submit) or actual if ($('#orderItemList .tabbar li').last().text() == "Submit") url = "printableOrderHTML.php?u="+dopeArray[0]+"&c="+dopeArray[1]+"&o="+dopeArray[2]; else url = "../ReceiveIt/printableOrderHTML.php?u="+username+"&c="+dopeArray[1]+"&o="+orderNo; bPrint(url); }); //Print function caller // SAFARI VERSION DEPENDENT - assumes "sVersion" has correct Safari version var iframe; function bPrint(url) { if (sVersion > "5.0.6") if ($('iframe').html() != null) $('iframe').remove(); // newer Safaris require this done here iframe = document.createElement("iframe"); // create an iframe so that no window pops up document.body.appendChild(iframe); // insert the element to the DOM aSp = 0; $.ajax({ url: url, success: printCallback }); } function printCallback(data) { var error=/Error:/g; if (error.test(data) == true) { $('#error #results').html(data); jQT.goTo('#error','slideleft'); } else { iframe.contentWindow.document.write(data); // write the HTML to be printed iframe.contentWindow.print(); // print it if (sVersion <= "5.0.6") $('iframe').remove(); // older Safaris get this done here, where it should be return true; } } ============================== …as I said, desktop Safari likes this just fine. In iOS, I get a blank preview page. Apparently I’m not the only one: https://github.com/mozilla/pdf.js/issues/7597 All iOS12 simulator devices give me a blank page.
Attachments
Radar WebKit Bug Importer
Comment 1 2018-12-12 13:19:34 PST
Lou Mazz
Comment 2 2018-12-12 15:42:35 PST
Stupid programmer error - variable "sVersion" test was wrong. Fixed test - printing works.
Lou Mazz
Comment 3 2018-12-12 15:43:46 PST
Stupid programmer error - xVersion test was wrong, so iFrame was being deleted. Fixed test - printing works.
Simon Fraser (smfr)
Comment 4 2018-12-12 15:45:34 PST
Great!
Note You need to log in before you can comment on or make changes to this bug.