SitePoint Sponsor

User Tag List

Results 1 to 19 of 19
  1. #1
    SitePoint Guru arunkumar's Avatar
    Join Date
    Jan 2005
    Location
    India:Chennai
    Posts
    827
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    hiding code from view source

    Sir,

    Is there is any way to hide my html source so that by viewsource the user cannot steal my code.

    I tried by disabling the right click by javascript but by using the window key in keyboard the user ca take it i aslo tries to caputure the key code but there is no keycode for window key.


    Any way?????????


    Thanks in advance,
    ArunKumar
    Where there is a will there is a way
    ArunKumar

  2. #2
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    Sweden
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't think it's possible, but why so worried about someone stealing you html-code?
    Saywoot.net - Online Comic!

  3. #3
    SitePoint Wizard Dylan B's Avatar
    Join Date
    Jul 2004
    Location
    NYC
    Posts
    1,150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, and even if you could, I could simply downlaod the page to my computer.

  4. #4
    SitePoint Evangelist jplush76's Avatar
    Join Date
    Nov 2003
    Location
    Los Angeles, CA
    Posts
    460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    check out the zend encoder
    My-Bic - Easiest AJAX/PHP Framework Around
    Now Debug PHP scripts with Firebug!

  5. #5
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Parry Sound, ON
    Posts
    725
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is a PHP question because....?

  6. #6
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Zend Encoder encodes PHP files, so I suppose to encode your HTML files, you'd need to rename them all to PHP

    And spending that kind of money on the Encoder just to encode HTML files is stupid, and for what? Your server would then need the decoder for your browser to render the pages...

    But this is really, really pointless. HTML is not a new clever science, hell there are a million and one tutorials all over the web. Anyone can do it now, it's that simple so why try to mask it?

    Want to ask another silly question? Please, I dare you...

  7. #7
    Non-Member bronze trophy geniusgoalie's Avatar
    Join Date
    Sep 2004
    Location
    Buffalo, USA
    Posts
    979
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What is the benefit of hiding your source? It just makes your site annoying and amateur-ish.

  8. #8
    SitePoint Evangelist jplush76's Avatar
    Join Date
    Nov 2003
    Location
    Los Angeles, CA
    Posts
    460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    its not a silly question, if you have proprietary data you wish to hide from the user encoding is the way to go. We use it for our enterprise products and it encodes any kind of file you want, not just .php files.

    If you're just creating a small site for yourself and friends then its overkill but if you're looking to sell an application then its the way to go.
    My-Bic - Easiest AJAX/PHP Framework Around
    Now Debug PHP scripts with Firebug!

  9. #9
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jplush76
    its not a silly question, if you have proprietary data you wish to hide from the user encoding is the way to go.
    How would plain HTML contain proprietary data that isn't available on the actual page itself? HTML is nothing more than markup for your content. Your page is your content. Hiding the source is just as pointless as hiding the page content.

    Encoding the server-side source when distributing code is certainly useful for commercial projects, but client-side code masking is silly.

  10. #10
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And can I just take the time to mention that disabling right-click is:

    a) incredibly annoying. Stop playing around with my GUI.
    b) easily worked around by disabling javascript (which I can do with one click in Firefox w/t the developers toolbar, and a couple of clicks without it).

  11. #11
    SitePoint Evangelist jplush76's Avatar
    Join Date
    Nov 2003
    Location
    Los Angeles, CA
    Posts
    460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    in my case the output that is sent to the browser in not encoded but the actual html src files are because we distribute our application. I believe he is talking about what the browser renders but consider he makes his money as a freelance web designer...

    he makes a site for a client, its all html, nice and pretty... he shows it to the client and now the client can copy everything, use the site and not pay him. I've heard of that happening quite a few times from people I know.
    My-Bic - Easiest AJAX/PHP Framework Around
    Now Debug PHP scripts with Firebug!

  12. #12
    SitePoint Evangelist jplush76's Avatar
    Join Date
    Nov 2003
    Location
    Los Angeles, CA
    Posts
    460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Luke Redpath
    And can I just take the time to mention that disabling right-click is:

    a) incredibly annoying. Stop playing around with my GUI.
    b) easily worked around by disabling javascript (which I can do with one click in Firefox w/t the developers toolbar, and a couple of clicks without it).
    thats definately the truth, I hate the right click disable.. its pointless, same as when people don't let you right click their images when all I have to do is print screen or view the source and access the file directly.
    My-Bic - Easiest AJAX/PHP Framework Around
    Now Debug PHP scripts with Firebug!

  13. #13
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,014
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    actually, yes, there are three good ways to hide your source code

    one is to set the following META tag in the <head>...</head> --
    Code:
    <meta http-equiv="view-source" content="no">
    two is to use the <hide>...</hide> tags around every block of code that you want to hide

    three is to download the source code of your page to a CD, delete the source code from your server/host, delete the source code from your own computer, take the CD to your toaster, dial a nice deep brown colour, and pop it in
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  14. #14
    Non-Member bronze trophy geniusgoalie's Avatar
    Join Date
    Sep 2004
    Location
    Buffalo, USA
    Posts
    979
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937
    actually, yes, there are three good ways to hide your source code

    one is to set the following META tag in the <head>...</head> --
    Code:
    <meta http-equiv="view-source" content="no">
    two is to use the <hide>...</hide> tags around every block of code that you want to hide

    three is to download the source code of your page to a CD, delete the source code from your server/host, delete the source code from your own computer, take the CD to your toaster, dial a nice deep brown colour, and pop it in

  15. #15
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Parry Sound, ON
    Posts
    725
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's a PHP method. Put this at the top of all files:
    PHP Code:
    die('Sorry, you can\'t see my page because you might steal my source.'); 

  16. #16
    SitePoint Evangelist jplush76's Avatar
    Join Date
    Nov 2003
    Location
    Los Angeles, CA
    Posts
    460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    here are some links I found for you that might help

    http://www.antssoft.com/htmlprotecto...m?ref=overture

    http://www.aw-soft.com/htmlguard.html

    though neither seems all that great
    My-Bic - Easiest AJAX/PHP Framework Around
    Now Debug PHP scripts with Firebug!

  17. #17
    SitePoint Evangelist jplush76's Avatar
    Join Date
    Nov 2003
    Location
    Los Angeles, CA
    Posts
    460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    is this forum for helping people or making fun of their questions?
    My-Bic - Easiest AJAX/PHP Framework Around
    Now Debug PHP scripts with Firebug!

  18. #18
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Parry Sound, ON
    Posts
    725
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is the PHP forum, actually, and the question has absolutely nothing to do with PHP.

    Furthermore, the original question has no solution. So, since we've all seen the question a million times before, we're having fun.

  19. #19
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,014
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    jim, could you show me one of your pages where something has been done to prevent me from seeing the source code

    it's always fun to see how many seconds it takes to crack it

    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •