I need some help please

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Russell McDade

    I need some help please


    I have a html page that I don't want anyone to print. Is there a way using
    JavaScript to send an alert to the user to warn [or stop] them from trying
    to print the html page? Is there an onPrint event handler? In my book
    'JavaScript a Beginner's Guide' by John Pollock none is listed. Can a
    function be written that will execute if someone tries to print the html?
    Thanks in advance

    P.S. I also have a printable version of the page in pdf which is for
    printing


  • Ivo

    #2
    Re: disabling printing (was: I need some help please)

    "Russell McDade" <donteventhinka boutit@all.com> typed[color=blue]
    > I have a html page that I don't want anyone to print. Is there a way using
    > JavaScript to send an alert to the user to warn [or stop] them from trying
    > to print the html page? Is there an onPrint event handler?[/color]

    There isn't, and if there were, I could use the "Print-Screen" button,
    modify the script on the page via the addressbar, turn off Javascript
    altogether, etc.etc. The idea is on a par with disabling right-clicks to
    "protect" images, it goes against the nature of the web. And for anything
    like a solution, knowing why you do not want it in the first place might
    help.
    [color=blue]
    > P.S. I also have a printable version of the page in pdf which is for
    > printing[/color]

    That is certainly nice. If you put the following on your page, who would
    want to disturb your peace:
    <p>Please do not this page. I also have a <a
    href="printable version.pdf">pr intable version</a> of the page in pdf which
    is for printing.</p>

    By the way, we all want help. Descriptive subject lines do just that.
    HTH
    Ivo


    Comment

    • Jeff North

      #3
      Re: I need some help please

      On Sun, 23 May 2004 10:09:27 +1000, in comp.lang.javas cript "Russell
      McDade" <donteventhinka boutit@all.com> wrote:
      [color=blue]
      >|
      >| I have a html page that I don't want anyone to print. Is there a way using
      >| JavaScript to send an alert to the user to warn [or stop] them from trying
      >| to print the html page? Is there an onPrint event handler? In my book
      >| 'JavaScript a Beginner's Guide' by John Pollock none is listed. Can a
      >| function be written that will execute if someone tries to print the html?
      >| Thanks in advance
      >|
      >| P.S. I also have a printable version of the page in pdf which is for
      >| printing
      >|[/color]
      <head>
      <link rel=alternate media=print href="mypage.pd f">

      </head>

      or

      <style>
      @media print {
      ..noPrint { display: none; }
      }
      </style>
      <body>
      <div class="noPrint" >
      ....
      </div>
      ---------------------------------------------------------------
      jnorth@yourpant sbigpond.net.au : Remove your pants to reply
      ---------------------------------------------------------------

      Comment

      • Russell McDade

        #4
        Re: I need some help please


        "Jeff North" <jnorth@yourpan tsbigpond.net.a u> wrote in message
        news:bv30b0hshj pt8cc1okc4nu0ne fqbkf9g7r@4ax.c om...

        <snip previous>
        [color=blue]
        > <head>
        > <link rel=alternate media=print href="mypage.pd f">
        >
        > </head>
        >
        > or
        >
        > <style>
        > @media print {
        > .noPrint { display: none; }
        > }
        > </style>
        > <body>
        > <div class="noPrint" >
        > ...
        > </div>
        > ---------------------------------------------------------------
        > jnorth@yourpant sbigpond.net.au : Remove your pants to reply[/color]



        Thanks Jeff, both these techniques work.

        Russell



        Comment

        Working...