#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    63
    Rep Power
    12

    Make Print Useless Using CSS


    I'm trying to prevent users from printing my pages. I'm not looking for something too serious, just enough to deter the average user. Right now I have the following in my css file:

    @media print {
    BODY {
    display:none;
    }

    This works pretty well and just gives a blank page if someone tries to print. However, this was tested on a mac using IE 5.1 and it didn't work. Is there a way to make this method work across platforms and with different browsers? Thanks in advance.

    John
  2. #2
  3. Retired
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2002
    Location
    Finland
    Posts
    9,143
    Rep Power
    2493
    It may be that MAC doesn't understand the @ in the stylesheet parameters. If you use <link> it should work, like so:
    Code:
    <link rel="stylesheet" type="text/css" href="default.css" title="default" media="screen" />
    <link rel="stylesheet" type="text/css" href="print.css" title="default" media="print" />
    with print containing your line of code:
    Code:
    BODY {
    display:none;
    }
    with href being the path/filename of your stylesheet. HTH

    Cheers,
    Jamie

    >_ skiFFie ? | Twitter

    __________________

    Let the might of your compassion arise to bring a quick end
    to the flowing stream of the blood and tears .....
    Please hear my anguished words of truth.

    __________________

IMN logo majestic logo threadwatch logo seochat tools logo