A frequent question we get from our Writing HTML tutorial is:

“what code can I use to prevent people from viewing/stealing the source code of my web pages?”

and the answer is very similar to what i say to people when they want to protect their images on web pages from being stolen- if you do not want someone out there to “steal” your web images– keep them off the internet. All of the techniques out there, JavaScript disabling of right mouse clicks is baby stuff to circumvent.

But rather than respond with my own tirade, I typically gently suggest that it is more trouble than it is worth, and seed them with a good google link for reference resources, for the above question:
http://www.google.com/search?q=hide+web+page+source+code

Top of that is a great site from Vortex Designs, How to prevent theft of your source code!, that starts with this bit of humor:

Here are a number of very effective methods of keeping unscrupulous surfers from stealing your HTML source:

1. Use the <INVISIBLE> </INVISIBLE> tags around the entire document.
2. Use the DONTSTEAL attribute in the <BODY> tag.
3. Ftp to your server, select all files and directories, hit “Delete”.
4. Put every existing copy of every file on floppies, place them in a shoebox and bury them in the backyard. There is another version of this method which involves placing the floppies in a plastic bag and hiding them in a different sort of hole. Both are equally effective.
5. Password protect your entire site and make sure no one has the password, not even you.
6. Employ a small but fanatically loyal and well-armed band of mercenaries to guard your site.
7. Start>Run>format C:\
8. Attack dogs, preferably rabid.
9. Use any version of Microsoft Frontpage to create your site. (This won’t prevent people from viewing your source, but no one will want to steal it.)
10. Don’t put your pages on the web.

but then gets down to business shooting holes in most of the typical suggested methods.

There are design elements I may emulate, copy a method, but how rare would it be that another site would have all of the information elements that one would even need to “steal” it all? It has yet to happen.

In more than 10 years of looking at web sites, I am hard pressed to think of many sites worth “stealing” the code from, although I regularly poke around source code to get ideas on how some sites do their designs. It is how I learn the most, but I have never found a piece of source code that I could use by outright copying. It is against my own philosophy of a shared network of knowledge to try and put the web page designs behind a barbed wire fence.

But if you need some good HTML attack dogs (method 8), let me know- we deliver.

The post "How to Stop HTML Thieves" was originally slapped on the butt by a cigar smoking doctor yelling "It's a post!" at CogDogBlog (http://cogdogblog.com/2004/07/how-to/) on July 20, 2004.

1 Comment

  • James

    Heh :o)

    Like asking ‘how can I stop someone from photographing my house?’ or ‘How can I stop someone from quoting me?’

    We need a similar one for ‘but someone could read what my students write if we can’t protect it we can’t have it’ and ‘I don’t like the kind of language used in weblogs’ and so it goes and so it goes