How to Disable the Copying of Web Pages

As a webmaster or website owner, you might be concerned about someone hijacking your website's content, such as your pictures and text. There is a simple method that allows you to turn off the copy-and-paste functionality while a visitor is viewing your website. It involves a small Javascript code snippet. Approximately 95% of Internet users have a browser with Javascript automatically turned on; so, there is a tiny chance this method will not work for all your site visitors.

Things You'll Need

  • Webpage files
  • Javascript code snippet
  • Web server
Show More

Instructions

    • 1

      Open the webpage files on which you want copying disabled. You can open your files in a simple text editor or your preferred HTML editor program.

    • 2

      Paste the following Javascript code snippet into your open webpage file. It should be copied between the existing HEAD tags.

      <script type="text/JavaScript">

      function killCopy(e){

      return false

      }

      function reEnable(){

      return true

      }

      document.onselectstart=new Function ("return false")

      if (window.sidebar){

      document.onmousedown=killCopy

      document.onclick=reEnable

      }

      </script>

    • 3

      Save the webpage file in your text or HTML editor.

    • 4

      Upload the newly saved webpage files to your web server. You may choose to upload via FTP or your server host's built-in file manager. Make sure the webpage files are uploaded back to the same directories in which they were previously stored.

Tips & Warnings

  • This code works on Internet Explorer, Firefox, Chrome and Safari.

  • For additional security, you may want to disable mouse right-click for your webpages.

  • This code snippet only works on browsers that have Javascript enabled.

Related Searches:

References

Comments

You May Also Like

Related Ads

Featured