You can't print this blog post


Update! It's fair to say no one liked this idea - so I've reverted it. Thanks for all the feedback 🙂

Do you ever see those daft email footers which say "Please consider the environment before printing this email." Like, who the fuck is still printing out their emails?

Anyway, a few years ago I went along to a blogging event where someone had printed out one of my blog posts. I was stunned. They'd stuck of loads of my posts (and other people's posts) on a mood board. Because I'm a digital fundamentalist, this pissed me off - what a waste of paper. Printing off a blog post is like making a radio broadcast of a sunset. Just pointless.

Luckily, there's a (very weak) form of DRM you can use to dissuade people from printing off your web pages:

@media print {
  html { display: none; }
}

CSS has Media Rules for printing. You're supposed to use it to remove background images, menu bars, and other things which aren't useful. In this case, I've just told the browser not to display any content when it tries to print.

You can go a little further. This stops the page from rendering when printed, and adds a handy error message:

@media print{
    body { display: none; }
    html::after {
        content: "Please consider the environment before printing this blog.";
    }
}

I've tested this, and it works in Firefox, Safari, and Chrome. It's trivial to defeat this technical protection mechanism if you're handy with developer tools - but I guess those aren't the people who are printing off the entire Internet.


Share this post on…

41 thoughts on “You can't print this blog post”

      1. Yeah, but what format will you get? There has been a format wars in this space going on for years. Multipart-HTML has made a reappearance in recent versions of Blink, but won’t open in Safari or Firefox. Safari has its own binary-XML M/HTML-inspired “Web Archive” format that won’t open in any other browser. Firefox saves the HTML file together with a directory of most but not all the resources required to render a page. This last format is similar to Blink’s default non-M/HTML format, but makes different decisions about what parts of the document to save.

        Print to PDF is a good and accessible method for archiving pages that preserves formatting. Web developers can spend two minutes out of every year to add a @media (print) { some-miniscule-layout-fixes-to-optimize-for-print } and their users will get a good-enough archival format when they need it.

        Reply
  1. Sorry Terry but this is an ableist idea.

    For example, my parents get a visitor to print emails so that my Mum (who is bedridden and who can’t use an electronic device due to mental confusion) can enjoy reading them to my Dad who is blind. This gives them both pleasure.

    You might argue that your blog posts aren’t aimed at my parents and you would be right, but I am sure that there are other examples of perfectly good reasons why people want or need to print your stuff.

    If I do, I’m sufficiently web-savvy to copy it to a something that will print.

    Why take away a sensible feature that you don’t know all the use-cases for?

    (And I recall you got quite narked with an app that did that to you recently)

    Reply
    1. Strongly agree. You can use the same CSS technique to add a warning message admonishing people against wasting paper without taking away accessibility.

      Reply
  2. said on mcd.dk:

    @Edent one time while I worked as an it consultant someone at an oil company had this huge footer about considering the environment before printing the email.I couldn't decide if it was more paradoxical because they worked at an oil company or just that the footer easily quadrupled the print size of every single email.Also, lots of people still print emails. At my previous job we had departments wearing down enterprise printers in months because they printed EVERYTHING..

    Reply | Reply to original comment on mcd.dk
  3. Alcides Fonseca says:

    Good way to prevent someone from suing you based on your blog content. They won't be able to print it to include in the legal process!

    Reply
  4. says:

    I agree with what Caroline Jarrett posted above — this is a very bad idea that doesn't help anyone. I haven't printed off a web page onto paper in years, but what I have done is 'print' pages as PDF documents for reference. Your CSS hack would remove that option too.

    Look, I get the desire to minimise your environmental footprint, I'm trying to do the same here as much as possible. But there's no need to be snarky about it.

    Reply
  5. Others already pointed out how this is an accessibility problem for disabled users. The approach also prevents "printing" to PDF which I might wanna do to read your post on my E-Reader.

    Reply
    1. @edent says:

      Your eReader will read HTML just fine. And it will be a better experience than PDF.

      Reply
        1. @edent says:

          ePub is just zipped HTML. Every eReader I've had can read HTML files. Which one do you have?

          Reply
          1. It's a Remarkable 1. See https://support.remarkable.com/hc/en-us/articles/360006761638-Which-file-types-are-supported-on-reMarkable-

            Anyway, I think this discussion is missing the point. You are actively sabotaging a browser feature because you think know better than your users how they want to interact with your content. It's like disabling right or middle clicking or hijacking the back button.

            You're of course free to do whatever you want, especially on your own personal site. But I think you can see from the rest of the comments how people feel about this.

            Reply
  6. said on twitter.com:

    In user research I've found that people print things out:
    - so that they can 'work with it' by hand (including a dyslexic person)
    - so that they can take it in the car and fill out forms on their phone while watching the kids
    I save my hate for screens that use up all the ink…


    Reply | Reply to original comment on twitter.com
  7. You may not see a need for paper, but to deliberately break it for those who do is some incredibly elitist bullshit. Maybe someone “prints to their e-reader” as a read-later list Why not optimize the print pages instead? It’ll take you two minutes to tweak the layout to ensure needless extra pages or interactive page elements (like that huge calendar further down on this page) aren’t printed. That’ll preserve functionality for those who need it, and avoid wasting more paper than absolutely required.

    Reply
    1. @edent says:

      Which part of "digital fundamentalist" made you think I wasn't elitist?

      Reply
  8. said on twitter.com:

    Others have said it more eloquently, but this is daft @edent – many folk have enough trouble already without useful functionality being disabled for lols. Besides, what's more wasteful? Printing a page I want to read, or printing a page but getting a sarcastic message instead?


    Reply | Reply to original comment on twitter.com
  9. said on twitter.com:

    How many sheets of recycled paper match the environmental impact of another device with another Li battery, more conflict minerals, more plastic. Framing this as an environmental thing obscures the behaviour it supposes on the other end (“just buy an e-reader”).


    Reply | Reply to original comment on twitter.com
  10. Suw says:

    I know you're just being a bit contrarian, but this is nonsense. As well as all of the good points above, I frequently print to PDF when I'm doing research so that I can put the document into Notability on my iPad and then scrawl notes all over it. There's no save-as option that achieves that, and trying to print to PDF from a saved version of this page also doesn't work. Screenshots won't work for a multi-screen page, and I shouldn't be forced to use specialist software to take a full screenshot when print to PDF is built right in. It's just not your responsibility to decide who prints what.

    Reply
    1. @edent says:

      I have seen the error of my ways and reverted. But I do wonder on your last point, do you think my print CSS should exclude page furniture? Someone higher up the comments wanted me to remove some of the navigation elements. But you're saying that I shouldn't.

      Reply
      1. Suw says:

        Printing from web pages is ugly right now, and it's kinda shocking to me that it's 2021 and no one seems to have really thought about the 'printing' use case at all. There ought to be options. Sometimes, yes, I'll want all the furniture because for whatever reason there's useful info there. Often, no, I just want the content. But mostly what you get now is a fugly mess instead, whether you want it or not.

        Reply
    2. Screenshots won't work for a multi-screen page

      You can save a screenshot of a multi-screen page using Firefox's built-in "Take Screenshot" feature (on the right-click menu, or Ctrl-Shift-S), then selecting "Save full page" at the top right. Sometimes you have to scroll to the bottom so that all the images load.

      It's possible this counts as specialist software.

      Reply
      1. Suw says:

        That's good to know, actually. But breaking built-in print-to-PDF would still be bad.

        Reply
  11. says:

    Sometimes I speak to (usually elderly) people who tell me of the great deal they have on their /subscription printing service/. I reply proudly that I print SO MUCH that the starter cartridge in our printer is still not done and it has been >4 years. Who prints anything these days, except when dealing with either bureaucracy, old people or the government?

    Reply

Trackbacks and Pingbacks

What are your reckons?

All comments are moderated and may not be published immediately. Your email address will not be published.Allowed HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <p> <pre> <br> <img src="" alt="" title="" srcset="">