Is there a way to track if a user prints a web page?

browser, html, javascript, printing

Solution

@Tahir Akhtar had the idea of using a print stylesheet. According to the comments, that doesn't work because the stylesheet is always fetched , regardless of whether the browser currently is in print view or not.

How about taking this further: Use a print stylesheet and define a style in it that makes the browser fetch a certain resource when it's rendered. The resource would return a transparent image.

As for the choice of CSS property, `background-image` is out, because they are usually not rendered by the browser. My thought would be a `list-style-image` or a `cursor`.

I think `list-style-image` on an absolutely positioned, transparent `<ul>` might do the trick without visually altering anything (I would not dare to position the element outside the page because of possible browser optimizations cutting it away). Every access to that resource should come from printing a page, or a print preview.

I can't test it right now, maybe later. If anybody tries it, I'd be interested to hear whether it works.

Problem

Is there a way to track if a user prints a web page? Thanks, Graham

Original source