How to Hide your HTML Source Code

Discussion in 'HTML & Website Design' started by largn81, Jan 26, 2008.

  1. #1
    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 circumvented. 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 Click Scripts
    These scripts stop users from right-clicking, where the "View Source" function is located.;)

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

    The right-click 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.:D

    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 circumvented, 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.:cool:
     
    largn81, Jan 26, 2008 IP
  2. Skinny

    Skinny Peon

    Messages:
    1,864
    Likes Received:
    93
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The fact is that if you don't want stuff stolen . . . don't put it online.

    Just a fact of the Internet. And some of this functions like no right click can tick off honest visitors, encryption can always be decrypted - so it's not worth the time.

    My 2 cents.

    Skinny
     
    Skinny, Jan 26, 2008 IP
  3. Apple888

    Apple888 Member

    Messages:
    52
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    45
    #3
    Some nice info on hiding source code. I gonna give it a try..
     
    Apple888, Jan 27, 2008 IP
  4. Traffik_Daddy

    Traffik_Daddy Peon

    Messages:
    136
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hmm, it was nice of you to post that info here to help people out, but what I find a bit ironic about this post is that it is about being able to protect information on a webpage, yet you have taken this content from a 2 year old thread at http://www.webdeveloper.com/forum/showthread.php?t=89947

    Sorry, but I found it kind of funny :)

    However, yes there is some good information here. It is virtually impossible to hide source code from users eyes, html anyway. It cant be hidden from users and it cant be hidden from website-scrapers. You can stop a website-scraper from reaching your web-pages via a robots.txt but sometimes it might be too late before you find out the name of the software that has scraped your site and content.

    TD
     
    Traffik_Daddy, Jan 27, 2008 IP
  5. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #5
    If you're so ashamed of your code that you don't want people to see it, you shouldn't be coding anyway : )
     
    Stomme poes, Jan 27, 2008 IP
  6. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #6
    yeah nice summary post was looking for something on this, guess all the methods are pretty useless,
    but another method to stop people from stealing is to watermark everything, for example your pictures, flash creation etc...
    as for articles you can take action if somebody takes them..
     
    wd_2k6, Jan 27, 2008 IP
  7. newcentury

    newcentury Well-Known Member

    Messages:
    193
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    108
    #7
    It's no use, men! With Firefox, guess can easily get your source code and download all things they want from your website
     
    newcentury, Jan 28, 2008 IP
  8. soulscratch

    soulscratch Well-Known Member

    Messages:
    964
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    155
    #8
    With firefox? You mean with almost any browser?
     
    soulscratch, Jan 28, 2008 IP
  9. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Any browser with something like NoScript : )

    "Stealing" code is silly, it's like seeing a house who's design you like, and building one just like it. Hardly theft. Images, on the other hand, can indeed be stolen and should be watermarked. Any art created by someone is automatically copywrit; however in order to actually sue someone for damages from theft, the art needs to be registered too.
     
    Stomme poes, Jan 29, 2008 IP
  10. jigolo

    jigolo Peon

    Messages:
    312
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #10
    There are some scripts was putted on your header that disallows your mouse on to "right click" option.. That either IE or Firefox browser that youre using it will not allowed the right click option which you can not used the "view source" option in the browser.. I refer you guys to copy and learn some good scripts code in the Scripts.com :) there's so many scripts there regarding on your request!!
     
    jigolo, Jan 29, 2008 IP
  11. soulscratch

    soulscratch Well-Known Member

    Messages:
    964
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    155
    #11
    Gotta love "blind posting" (where people don't even read the original post and reply to the title of the thread).
     
    soulscratch, Jan 29, 2008 IP
  12. jamesicus

    jamesicus Peon

    Messages:
    477
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Some of you may have encountered this puzzle previously -- it is a great challenge -- a good way to test your web authoring skills and a nice diversion from "headaching" coding sessions. It also illustrates the futility of trying to hide source code If you crack it, don't post your hidden message answer here just yet -- I will do so after a short while.

    http://www.drpeterjones.com/hidden/hidden.php
     
    jamesicus, Jan 29, 2008 IP
  13. TheOriginalH

    TheOriginalH Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    That is priceless! :D
     
    TheOriginalH, Jan 29, 2008 IP
  14. jigolo

    jigolo Peon

    Messages:
    312
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Take look!
     
    jigolo, Jan 30, 2008 IP
  15. largn81

    largn81 Peon

    Messages:
    237
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    i found it in article website it's not copyright breaking maybe i took 2 years to write this reply but i swear i found it on website such as ezine articles, ... :)
     
    largn81, Jul 23, 2010 IP
  16. Deacalion

    Deacalion Peon

    Messages:
    438
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #16
    Sooo old - why respond when the post is dead? Trying to hide your HTML/CSS/JavaScript is absolutely pointless... the browser needs the source code to render the page. Use telnet to grab the source if you're trying to disable right click (or just hit Ctrl+U) and use debuggers to step through it if it's 'encrypted'.

    Obfuscating code is a complete waste of developers time... which we're very short on as it is. Just make things pretty, if people copy you - consider it a compliment. :)
     
    Deacalion, Jul 23, 2010 IP