Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: blocking ctrl+p

  1. #1
    New to the CF scene
    Join Date
    Nov 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy blocking ctrl+p

    hi everyone ,
    i want to blocking print hotkey and i didn't find a way.
    i tried
    <body onbeforeprint="return false;" ...
    <body onkeypress="[control codes]" ...
    is there anyone to solve this...

    and disabling the Print dialog box in this thread there is some way to disabling print box but in xp it doesn't work

    thanks...

  • #2
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    How about...

    Creating a CSS print sheet containing -

    Code:
    body {
    display: none;
    }
    Whenever they print, it'll come out blank.

    Or, a IE-only solution -

    Code:
    <body onBeforePrint="document.body.style.display='none'"; onAfterPrint="document.body.style.display='';">

  • #3
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    Remeber: If you put content on the web, people will be able to get it. Period. I don't want to start another thread about whether or not it is possible to hide this or that from the client. It isn't. You may be able to prevent them from printing your webpage easily, but you cannot prevent it altogether.

    a) A client trying to print your content could use the print scrn button, and then paste into paint and print from there.

    b) A client could copy your source code, and then go through and remove the bits of code that prevent printing, update the links, and print the file from his hard drive.

    Your methods might stop a casual user, but aren't bulletproof.

    Dan

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,465
    Thanks
    0
    Thanked 633 Times in 623 Posts
    Ctrl-P is processed by the web browser and therefore doesn't get passed to the web page.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #5
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    But you can set up a special print CSS sheet with the display:none; property which will print a blank page..

    Dan

  • #6
    Regular Coder
    Join Date
    Oct 2005
    Location
    NYgamers.net
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There is also screen captures as well not to mention browser cache, etc.

    Don't put anything online that you can't afford to give away. It's that simple.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •