Bug 192585
Summary: | iFrame printing works in desktop Safari, but not mobile... | ||
---|---|---|---|
Product: | WebKit | Reporter: | Lou Mazz <l.mazz> |
Component: | Frames | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED CONFIGURATION CHANGED | ||
Severity: | Normal | CC: | bfulgham, cying, dbates, simon.fraser, webkit-bug-importer |
Priority: | P2 | Keywords: | InRadar |
Version: | Safari 12 | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Lou Mazz
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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/46673189>
Lou Mazz
Stupid programmer error - variable "sVersion" test was wrong.
Fixed test - printing works.
Lou Mazz
Stupid programmer error - xVersion test was wrong, so iFrame was being
deleted. Fixed test - printing works.
Simon Fraser (smfr)
Great!