Call: (209) 560-6611

Disable View Source

Date: May 1, 2012 Author: ang Category: Affordable Web Design Internet Tips Tutorials Tags: Comments: 0

Can I stop people from copying my website our source code? The answer is no.

I hear a lot of website owners complaining that their competitors are copying their website content. I have to tell them plain and simply, there's nothing they can do about it. If you have a website that's good enough to copy, people will do just that. It's extremely annoying I know.

You can make it more difficult for these copycats to access your source code. You can disable the right mouse click view source code option. They will still be able to use the browser's menu to view the source code, but why not force them to take a few extra steps for spite?

How to disable View Source

  1. Open your HTML document in your favorite editing program and enter this code in the header section:
     Javascript |  copy code |? 
    01
    <SCRIPT TYPE="text/javascript">
    02
    function disableselect(e){
    03
    return false
    04
    }
    05
    function reEnable(){
    06
    return true
    07
    }
    08
    //if IE4+
    09
    document.onselectstart=new Function ("return false")
    10
    //if NS6
    11
    if (window.sidebar){
    12
    document.onmousedown=disableselect
    13
    document.onclick=reEnable
    14
    }
    15
    </SCRIPT>
  2. Save your document.
  3. If you have a WordPress website you can access your header code by logging into admin then clicking on 'Appearance' > 'Editor' > 'Header'. Don't forget to save your changes.
  4. Don't forget to save your changes.

Again, this doesn't prevent visitors from viewing your source code using the browser's menu options, this only prevents visitors from viewing your webpage source code using the right mouse click view source option.

Leave a Reply

Your email address will not be published. Required fields are marked *

Before you post, please prove you are sentient.

what is 9 plus 4?

Before you post, please prove you are sentient.

What is 2 * 7?