How to Hide your Source Code!

Any problem with HTML can be discussed here.
Mizo

How to Hide your Source Code!

Post by Mizo »

This question gets asked fairly often on this forum, so we've assembled here a definitive answer to the question of how one can hide their HTML source from people. Unfortunately, the short answer is, you can't. There have been various methods put forth, but all of these are easily ****. In the end, the only sure fire way to make sure no one can steal your source code is to never put it on the Internet at all.

Source Padding

Really, the oldest trick in the book. It involves adding a ton of white space before the start of your code so that the view source menu appears blank. However, must all people will notice the scroll bars and will scroll around to find your code. As pointless and silly as this method is, there are some still who use it.

No Right **** Scripts

These scripts stop users from right-****, where the "View Source" function is located.

Cons:

Notoriously hard to get working across browsers and to actually work properly.

The right-**** menu, or context menu, includes many helpful tools for users, including navigation buttons and the "Bookmark Page" button. Most users don't take kindly to having their browser functionality disabled and are inclined not to revisit such pages.

The View Source function is also available through the top Menu. At the main menu bar at the top of your browser, select View, and then in the sub-menu, you'll see "View Source" or something similar. Also, there are keyboard shortcuts like Ctrl+U that can be used to view source. All this method does is add about a two second delay to someone trying to view your source and it does irritate users who aren't trying to view your source.

"JavaScript Encryption"

This is by far the most popular way to try to hide one's source code. It involves taking your code, using a custom made function to "encrypt" it somehow, and then putting it in an HTML file along with a function that will decrypt it for the browser. A User is able to view the source, however, it isn't understandable.

Cons:

Your website is only usable for users with JavaScript enabled. This rules out search engines, users who've chosen to disable JavaScript, and users using a textual browser (such as the blind) that doesn't have JavaScript capabilities. Remember, JavaScript is a luxury, not a necessity on the web.

You have to include a means of decrypting the page so the browser can display it. Someone who understands JavaScript can easily decrypt the page.

Many browsers provide alternative ways around this. Some, like Netscape 7.0, allow you to save the page, decrypted for easy viewing later. Others, like FireFox, include tools like the DOM Inspector, which allows you to easily view and copy the XML of the page, decrypted.

HTML Protection Software

There are some less than honest people who want to sell your software to quickly and conveniently "protect" your source code. This type of software generally employs the above methods, in varying ways, to hide your source code. Many people think that if they are buying it, it must work. It doesn't. As we've seen, the above methods are all easily ****, and all this software does is implement these horribly flawed methods for you and take your money. Don't fall for them, I've yet to see a single one that's worked, and they never will.

Isn't there Any Hope?

The bottom line is that browsers need to see the unencrypted, plain text source code to create a webpage. For that reason, it's impossible to hide your HTML source code. If the browser can read it, which it needs to be able to do to render a webpage, then so can a user. That's the bottom line.

But My Page Was Stolen!

A lot of people look for this after having their website pirated. I know it's cruel that in a few minutes someone can steal hours of your work, but hiding your source code can't help you. Contacting the person in question and asking them to take it down solves many cases. Otherwise, contact the web host or the persons ISP and explaining the situation is a good course of action. I can't give you legal advice, but if you feel your copyrights are being infringed, you can contact a lawyer. But hiding (or "encrypting") your source, won't do much of anything at all.


gemini181
Posts: 45
Joined: Fri Mar 17, 2006 10:58 pm

Post by gemini181 »

Great post, on a topic I'm interested in! :)

I'm not looking to start a debate, but what about PHP?
I modify and upgrade, but don't program. Is it true or false PHP can be used to hide source code?

Thanks,
MGH
mstewart1409
Posts: 4
Joined: Sat Apr 15, 2006 9:22 am

Post by mstewart1409 »

Good Post!

Usually I don't bother reading long topics however this was something that interested me. It will prove very useful to people who are desperate to hide their site and those who are unsure weather it can be done!

Well Done :)
Mizo

Post by Mizo »

Thanks guys a lot for the nice replys

and for gemini181 i think thats there is a hide source code to PHP

i will look and get to a new topic soon :)
uz
Posts: 140
Joined: Sat Dec 24, 2005 5:32 pm

Post by uz »

do you have any ideas for joomla? how to do it in joomla
mohumben
Posts: 82
Joined: Thu Sep 15, 2005 9:45 pm

Post by mohumben »

You simply can't hide your source code, no matter what you are going to use; there is always a workaround.

PHP won't help, because it simply outputs HTML, so it's the same thing.

Code: Select all

define('I_LOVE_PHP', true);
gemini181
Posts: 45
Joined: Fri Mar 17, 2006 10:58 pm

Post by gemini181 »

[quote="mohumben"]You simply can't hide your source code, no matter what you are going to use]

I tried one of those (javascript) programs, and it doubled the size of my HTML files! Now I at least know it doesn't work.
gVeR
Posts: 27
Joined: Sun Jul 10, 2005 2:25 pm

Post by gVeR »

I was see some scripts, but I think we can't hide source codes :(
sethamin
Posts: 46
Joined: Thu Apr 06, 2006 5:47 pm
Contact:

Post by sethamin »

Very nice post man but you missed one thing. There are websites (like http://www.iqauto.com/cgi-bin/ripper.pl) that can rip the codes online. So even if the code is encrypted you can still get the html code. Maybe I shouldn't post the site but hey it's useful. No I don't go around ripping sites, but once I lost all my computer files and my host wouldn't allow me access to my website information so I used it. Regardless of how you look at it and even tho it is annoying when you find someone has ripped from you, don't deny that it could be necessary (like in my example) for when you need it.
ycttm
Posts: 20
Joined: Tue May 09, 2006 4:15 am

Post by ycttm »

Good Post!
i have look for it for a long time!
Locked