On Mon, 28 Dec 2009 14:39:06 -0500, Michael A. Puls II <shadow2...@gmail.com> wrote:

On Mon, 28 Dec 2009 12:08:48 -0500, Boris Zbarsky <bzbar...@mit.edu> wrote:

On 12/28/09 9:54 AM, Michael A. Puls II wrote:
As for window.print(), what if it returns false if printing is not
supported?

It might be better as |true| (crappy API issues aside), because otherwise if a page writes |if (window.print())| it'll get false in all existing browsers, no?

Ah, I see. Good point.

Since making print() return something isn't going to help with older UAs and returning true would feel backwards, instead of:

if (window.print()) {
    alert("Printing is not supported");
}

, we could do this:

if (typeof navigator.printingEnabled === "function" && !navigator.printingEnabled()) {
    alert("Printing is not supported");
} else {
    window.print();
}

It's more verbose though and I'm not sure any will like it. But, tossing it out there.

--
Michael

Reply via email to