Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. How to block user from copying data from webpage using javascript?

How to block user from copying data from webpage using javascript?

Scheduled Pinned Locked Moved Web Development
javascripttutorialquestion
8 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kiran S S
    wrote on last edited by
    #1

    I want to block user from copying data from the page. I have used javascript that block the right click of the user so he will not able use right click menu to copy and past data. But user can still copy data by using keybord keys "Ctrl + C" to copy it. Or they can save the page from file menu. Is there any technique to stops these two things. So i can block user from copying data. Regards,

    Kiran Sajanikar Software Engineer Pune, India.

    P S K 3 Replies Last reply
    0
    • K Kiran S S

      I want to block user from copying data from the page. I have used javascript that block the right click of the user so he will not able use right click menu to copy and past data. But user can still copy data by using keybord keys "Ctrl + C" to copy it. Or they can save the page from file menu. Is there any technique to stops these two things. So i can block user from copying data. Regards,

      Kiran Sajanikar Software Engineer Pune, India.

      P Offline
      P Offline
      Perspx
      wrote on last edited by
      #2

      No; JavaScript is run inside a sandbox and so the browser has control over what it does. JavaScript therefore cannot control any part of the browser, as it's run inside this protected environment. Without knowing what your project entails I cannot really comment much on it, but if you stop your users from copy + paste, what about print screen or just typing up the text manually? Regards, --Perspx

      "A refund for defective software might be nice, except it would bankrupt the entire software industry in the first year."
      -Andrew Tanenbaum
      "Einstein argued that there must be simplified explanations of nature, because God is not capricious or arbitrary. No such faith comforts the software engineer."
      -Fred Brooks

      K 1 Reply Last reply
      0
      • P Perspx

        No; JavaScript is run inside a sandbox and so the browser has control over what it does. JavaScript therefore cannot control any part of the browser, as it's run inside this protected environment. Without knowing what your project entails I cannot really comment much on it, but if you stop your users from copy + paste, what about print screen or just typing up the text manually? Regards, --Perspx

        "A refund for defective software might be nice, except it would bankrupt the entire software industry in the first year."
        -Andrew Tanenbaum
        "Einstein argued that there must be simplified explanations of nature, because God is not capricious or arbitrary. No such faith comforts the software engineer."
        -Fred Brooks

        K Offline
        K Offline
        Kiran S S
        wrote on last edited by
        #3

        While typing this thread I was also thinking that if I stop users from copy + paste, still they can use print screen or just they can type up the text manually. So I thought there could be some solution for it.

        Kiran Sajanikar Software Engineer Pune, India

        J S 2 Replies Last reply
        0
        • K Kiran S S

          While typing this thread I was also thinking that if I stop users from copy + paste, still they can use print screen or just they can type up the text manually. So I thought there could be some solution for it.

          Kiran Sajanikar Software Engineer Pune, India

          J Offline
          J Offline
          Jorgen Andersson
          wrote on last edited by
          #4

          What has left your network is ultimately not under your control any more. That's a fact. There will always be a way of circumvent your safety measures. Whether it's by using a cache or simply taking a photo of the screen or connecting a taperecorder to the line out. I wish this fact someday will get through to the legal peacounters in the media industry.

          1 Reply Last reply
          0
          • K Kiran S S

            I want to block user from copying data from the page. I have used javascript that block the right click of the user so he will not able use right click menu to copy and past data. But user can still copy data by using keybord keys "Ctrl + C" to copy it. Or they can save the page from file menu. Is there any technique to stops these two things. So i can block user from copying data. Regards,

            Kiran Sajanikar Software Engineer Pune, India.

            S Offline
            S Offline
            Saul Johnson
            wrote on last edited by
            #5

            Hi! There may be a way around your copy and paste shortcut problem. I'm not sure about cross-browser compatibility but try enclosing your text in paragraph tags with the UNSELECTABLE attribute set to 'On' like this:

            <HTML>
            <HEAD>
            </HEAD>
            <BODY>
            <P UNSELECTABLE="On">
            Test Paragraph
            </P>
            </BODY>
            </HTML>

            (Tested in IE 8 But it will probably work on earlier versions too) Of course people will be able to get around this in some way or another but hey, it can't hurt can it? Hope This Helps! MrWolfy :-D

            K 1 Reply Last reply
            0
            • K Kiran S S

              While typing this thread I was also thinking that if I stop users from copy + paste, still they can use print screen or just they can type up the text manually. So I thought there could be some solution for it.

              Kiran Sajanikar Software Engineer Pune, India

              S Offline
              S Offline
              sph3rex
              wrote on last edited by
              #6

              make sure they dun have a monitor :sigh:

              Code? Yeah i love it fried together with a glass of wine.

              1 Reply Last reply
              0
              • S Saul Johnson

                Hi! There may be a way around your copy and paste shortcut problem. I'm not sure about cross-browser compatibility but try enclosing your text in paragraph tags with the UNSELECTABLE attribute set to 'On' like this:

                <HTML>
                <HEAD>
                </HEAD>
                <BODY>
                <P UNSELECTABLE="On">
                Test Paragraph
                </P>
                </BODY>
                </HTML>

                (Tested in IE 8 But it will probably work on earlier versions too) Of course people will be able to get around this in some way or another but hey, it can't hurt can it? Hope This Helps! MrWolfy :-D

                K Offline
                K Offline
                Kiran S S
                wrote on last edited by
                #7

                Hay, Thanks for help. I tried this code, but it dosn't work with ie7. Hope we will find onther code for it.

                Kiran Sajanikar Software Engineer Pune, India

                1 Reply Last reply
                0
                • K Kiran S S

                  I want to block user from copying data from the page. I have used javascript that block the right click of the user so he will not able use right click menu to copy and past data. But user can still copy data by using keybord keys "Ctrl + C" to copy it. Or they can save the page from file menu. Is there any technique to stops these two things. So i can block user from copying data. Regards,

                  Kiran Sajanikar Software Engineer Pune, India.

                  K Offline
                  K Offline
                  kingsleen
                  wrote on last edited by
                  #8

                  In the please add this following and check the result .... ...

                  Kingsleen.J

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups