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.
Page 1 of 3 123 LastLast
Results 1 to 15 of 34
  1. #1
    New Coder
    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Restrict Printing and Text Copy

    I am trying to accomplish two things and am pretty sure JavaScript is the tool to do it, but don't know how.

    1) I am trying to disable a page from being printed and
    2) I am trying to disable the ability to copy and paste text or images from the web page.

    I would appreciate any assistance that I could get with this task.

    Thank you in advance,
    Brian
    Last edited by ExcelGuy; 09-26-2003 at 01:35 PM.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Planet Earth Code Poet: True
    Posts
    282
    Thanks
    0
    Thanked 1 Time in 1 Post
    Sorry, Javascript does not have this ability.

  • #3
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    You can *try* this for IE:

    <body onbeforeprint="return false" onprint="return false" onbeforecopy="return false" oncopy="return false" onbeforecut="return false" oncut="return false">

    I personally wouldn't like a site preventing me from copying text or disabling my ability to print it.

    Of course, all that is needed is to disable Javascript to copy and print anyway.

  • #4
    New Coder
    Join Date
    Jun 2002
    Location
    Central Ohio
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    I'm with JKD on this'un. I spend countless hours online every day, and well, after a while I need to 'keep my place' while reading. How do I do it? I highlight each word as I read it so eventually I've got a good half a page highlighted.

    Most 'copy prevention' methods disable highlighting, as well. And well, I don't like that.

    Not that you should ditch the idea just for me. Just saying, I'm sure I'm not the only one. Or maybe I'm a freak, and I am a freak, who knows.

    Jer!
    Jers-Web, Inc.
    Ever seen 49,825 Alert Boxes on one page? I have!

  • #5
    New Coder
    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Copying

    I am in agreement with you guys on it being annoying to not allow copying etc, but I am on a project where they are concerned about someone taking some published information, editing it, and then trying to come back and sue saying we gave them bad information.

  • #6
    Regular Coder Feyd's Avatar
    Join Date
    May 2002
    Location
    Los Angeles, CA Maxim: Subvert Society
    Posts
    404
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If that is the case, Excel, then you need something much more robust, you need it to be bulletproof, not relying on browser or he said she said kind of stuff.

    You need to look into Version Control systems which allow you to show exactly what was on your site at any time in the past, when and if anything changed, and various other things. A lot of CMS suites are actually just Version Control programs (Interwoven the horrible being a prime example)
    Moderator, Perl/CGI Forum
    shadowstorm.net - subvert society

  • #7
    New to the CF scene
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    No Text Select

    Here is a no text select script:

    <script language="JavaScript1.2">

    //Disable select-text script (IE4+, NS6+)

    function disableselect(e){
    return false
    }

    function reEnable(){
    return true
    }

    //if IE4+
    document.onselectstart=new Function ("return false")

    //if NS6
    if (window.sidebar){
    document.onmousedown=disableselect
    document.onclick=reEnable
    }
    </script>

    And this is a No right Click script:

    <script language=JavaScript>
    <!--

    //Disable right click script

    var message="";
    ///////////////////////////////////
    function clickIE() {if (document.all) {(message);return false;}}
    function clickNS(e) {if
    (document.layers||(document.getElementById&&!document.all)) {
    if (e.which==2||e.which==3) {(message);return false;}}}
    if (document.layers)
    {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
    else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

    document.oncontextmenu=new Function("return false")
    // -->
    </script>

    try those out

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Planet Earth Code Poet: True
    Posts
    282
    Thanks
    0
    Thanked 1 Time in 1 Post
    Resistance is futile. Like Feyd says you will have to look into other options if your end goal is just to cover your butt. NO matter what you do to a page dispalyed in a brwoser there is always a way to get around it.

    Using JavaScript to "disable" certain functionality within a page can be circumvented in several ways.

    I can't wait untill the FAQ page is up and running.

  • #9
    New Coder
    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks

    Thank you SteveKitz for the scripts. Again, I am in agreement with most of the comments about versioning and non-bulletproof systems. We are using Oracle Portal, which does allow for versioning, but I have spent too much time already trying to convince the high ups about the security they do not see.

    Get this, this is a corporate intranet site, only accessable with a VPN or from on our network. The stores that have the ability to connect are using a machine we built which is locked down to the point that they cannot save information to thier hard drive, and temp directories are deleted when the computer is rebooted, so if a machine is stolen, nothing is saved. The do not have e-mail, they do not have a floppy drive, and yet, that is not secure enough. The information we are putting out, used to be sent to the stores on paper and kept in notebooks in the back room. Anyone could take it or copy it.

    Anyway, not that anyone cares about all of this, I just appreciate the help and responses you guys gave.

    Thanks,
    Brian

  • #10
    New Coder
    Join Date
    Jun 2002
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I would like to be able to disable the print option, through anymeans necesarry, I'm developing an internal web-site, and some users may be able to view a document, but not have the print options. I've been going over this all day. Is there a way to cancel a print request in the onbeforeprint. I've tried everything posted here so far with no results.

  • #11
    Senior Coder
    Join Date
    Jun 2002
    Location
    41 8' 52" N -95 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Regarding your worry, that someone might modify the document - if I'm not mistaken all you need to do is save the document in UNmodified form - keep track of any changes by perhaps adding a datestamp to the filename.

    A check of the last modified date of the document(s) in question would reveal whether the document was taken and modified at a later date - wouldn't it?
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #12
    New Coder
    Join Date
    Jun 2002
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Okay this is the best that I've come up with, and maybe it will help others even though it doesn't exactly pertain to Javascript. but with the link tag you can do this

    <head>
    <link rel=alternate media=print href="blank.htm">
    </head>

    Anytime someone wants to print it prints the blank.htm instead. I know this works in IE 6, don't know about N6

  • #13
    Senior Coder
    Join Date
    Jun 2002
    Location
    41 8' 52" N -95 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    *sigh* - you can't stop people from printing/copying/viewing source code...

    I could still save the page from my temporary internet files, and take out the code you posted above... and just take the text as is.

    There isn't ANY way around that. Period. (Not if you want the page to display in a browser, at any rate...)
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #14
    New Coder
    Join Date
    Jun 2002
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well the people that this is for aren't that computer literate, so hopefully if I diable right click and remove the menu bar, that they won't see those options. Thanks for all the help guys.

  • #15
    New Coder
    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    It can be accomplished...

    Most of my users are in the illiterate category as well, but security is security, and underestimating your audience is not a good idea.

    As far as what can and can't be done, it is possible to combine all of the security restrictions that have been posted here and encrypts the page as well. My web searches found a program called Web Protecter 2.0, at http://www.protecthtml.com/ that supposedly accomplishes exactly what I am looking for. I think it is only $50 but I am interested to know what it is doing to accomplish the goal. I think it is opening the page in some java or JavaScript window that encrypts it, but I am not sure. I will probably just get the program, but I am really intrigued as to how this is working.

    Does anyone have experience with this program?


  •  
    Page 1 of 3 123 LastLast

    Posting Permissions

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