Closed
Bug 1247848
Opened 9 years ago
Closed 9 years ago
Support window.print()
Categories
(Firefox for iOS :: Browser, defect)
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
fxios | 4.0+ | --- |
People
(Reporter: vinoth.r, Assigned: st3fan)
References
(Depends on 2 open bugs)
Details
Attachments
(1 file)
User Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36
Steps to reproduce:
1. Open this url http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_print on your Firefox in iPad or android tablet.
2. Click print this page button
Actual results:
It doesn't open print dialogue but it does in desktop browsers, Safari for iPad and chrome for Android
Expected results:
It should promot print dialogue to print the page
Comment 1•9 years ago
|
||
This doesn't work in Chrome for iOS either (WKWebView). I suspect there is no method available or no delegate method hooked up.
Updated•9 years ago
|
Assignee | ||
Updated•9 years ago
|
Rank: 3
Comment 3•9 years ago
|
||
I'm pretty sure we don't support window.print on Android either.
Assignee | ||
Updated•9 years ago
|
Assignee: nobody → sarentz
Assignee | ||
Updated•9 years ago
|
Summary: window.print() doesn't respond in Firefox for iOS → Support window.print()
Assignee | ||
Comment 4•9 years ago
|
||
This patch adds support for `window.print()`. It does so by patching `window.print()` to our own handler, which sends a message to the native side of things. There we can use the standard iOS print infrastructure to print the `WKWebView`.
Assignee | ||
Updated•9 years ago
|
Assignee | ||
Updated•9 years ago
|
Attachment #8725082 -
Flags: review?(sleroux)
Comment 5•9 years ago
|
||
Comment on attachment 8725082 [details] [review]
PR: https://github.com/mozilla/firefox-ios/pull/1586
LGTM - left a comment on the PR.
Attachment #8725082 -
Flags: review?(sleroux) → review+
Assignee | ||
Comment 6•9 years ago
|
||
There was a question in the PR about supporting the onBeforePrint/onAfterPrint callbacks.
I have been testing this and it seems that WebKit instead supports this via the 'print' media query.
var mediaQueryList = window.matchMedia('print');
mediaQueryList.addListener(function(mql) {
if (mql.matches) {
document.getElementById("foo").innerHTML="beforePrint";
} else {
document.getElementById("foo").innerHTML="afterPrint";
}
});
Full demo at http://people.mozilla.org/~sarentz/t/onprint.html
This is triggered correctly via both this window.print() implementation and the system Print action from the Share Sheet.
So I think this is good to go in terms of WebKit compatibility.
Assignee | ||
Updated•9 years ago
|
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•