By Dylan Parry
Hiding your HTML source code sounds like a great thing to the unsuspecting newbie, but as always there are two sides to every story.
People new to making web sites tell me "I've worked hard to make my pages, I don't want people to steal my code". This is fair enough, you have spent ages getting your CSS to work just right (more likely tables if you are a true newbie) and the pages are working just right in all the browsers you have tried. Why should you let other people steal what you have spent so long doing?
True enough, you can use various little techniques to try and make it difficult for people to take your code, but all of these techniques are fundamentally flawed.
Disabling the 'right-click' menu is one such way that people attempt to stop you from viewing their source code. It might work for some people running Internet Explorer, but this method is easy to bypass. Simply by holding the right-mouse-button and then pressing return before releasing the button will, in most cases, allow access to the context menu. You can also access the source code by selecting 'View > Source' (or similar) on the menu bar of most browsers.
The drawbacks of this technique are quite obvious.
- Secondly, it only works in Internet Explorer - so Netscape users are immune, as are a plethora of other browsers out there.
- Thirdly, just think of all of those "left-handed" visitors to your site, you know, the ones that you are slapping in the face by disabling their ability to actually use any of the links on your site!
- Finally, the Apple Mac has no right-mouse-button - so how are you supposed to disable something that doesn't exist?
Of course, there is a real reason why you shouldn't try to hide your code. the Internet is a way of sharing information and ideas - not hiding them - and if you don't want people seeing your ideas then you shouldn't put them on the web, but rather dig a big hole and bury them where no one can find them or better still keep them in your head. Once a visitor goes to your site, they download the whole page to their computer automatically and so they have a copy that they can do whatever they want to it.
Copyright laws pertaining to work on the Internet state that all of your published materials (i.e. original text, original images) is considered copyrighted as soon as you created and published it - it does not however extend to the source code of your site (i.e. HTML) and so you cannot stop people from copying your code, but you can do something about people stealing your text or images. As a general rule, if you believe that you need to protect your site in this way and stop people from being able to view the source then you probably don't have anything that is actually worth stealing!
My personal belief is that you should let people use your source code in whatever way they wish. Afterall that is how ideas spread and that is one of the fundamental principles behind the Internet! So stop trying to hide your code, and share it with the world.
The author, Dylan Parry, is a student at University of Wales, Bangor, studying a degree in Computer Systems with Psychology. He has been designing web sites for over five years, and is the developer of Webpage Workshop.