How can I hide my HTML Source?

YOU CAN’T!

Next question please…

What? You want more?

OK, consider how the internet works: The browser gets an HTML file, maybe some CSS and/or Javascript files too, reads them and builds up a page as it’s requested to do. The browser has to be able to read the source, because that’s all it understands and that’s the only way your page is going to get built properly.

It follows that there’s no way that you can hide your source code from people, and still serve it up to browsers. Anybody who says that they can is selling snake oil. Sure you could use javascript to put some easily surmounted obstacles in the way of would-be source readers, but you won’t stop any moderately competent person from doing it. In addition, some JS obfuscation methods will prove fatal to your search engine position – usually a pretty undesirable side effect.

Even if it were possible, it wouldn’t be desirable. Consider again how the internet works, but at the human level this time. Designers and would-be designers have been able to look at eachothers’ code, copy and improve upon eachothers’ techniques, and build the internet we know and love. Does anybody think we’d have come so far in so little time if each little innovation was a jealously guarded trade secret?

So, love your “View Source” button. If people want to copy your amazing source (and, let’s face it, it probably isn’t and they probably won’t) you’re helping the progress of the human race. Who wouldn’t want to do that?

One Response to “How can I hide my HTML Source?”

  1. Dominic Says:

    However, I think that copyright makes sense. What makes no sense is to try to use technology to prevent people to copy your work that is available on the Internet. They try to do that with videos, but it does not really work. It sends the wrong message. People think that if they can defeat the technology, then it’s fine. It isn’t.

    I think the best way is to rely on the standard copyright approach that we use for books, etc. In the same way as authors and publishers, even though there is no technological constraint, do not use copyrighted work, web designers and web masters should not use copyrighted material in their web site. Why this approach, which works fine with books, does not work with website material? I think that the only reason is that a different category of people, less respectful of the work of others, design and maintain websites.

Leave a Comment