Hide Javascript From View Page Source?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chunk1978
    New Member
    • Jan 2007
    • 224

    Hide Javascript From View Page Source?

    hi there,

    so i vaguely remember viewing the source code to some internet sites, which appeared much shorter compared to the lengthy, complex content that was actually displayed... i'd like to know if there's a way to hide the script portion (or all portions) of an internet site from being viewed in a browser's "View Page Source"...

    thanks.
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    No that is not possible, because whatever techniques you use, anyone with some technical knowledge will be able to easily obtain your scripts. For example, you can use:
    [HTML]<script src="js/myjsscript.js"> </script>[/HTML] but I can easily download or view that script.

    Other techniques to 'hide' javascript involves encoding it and also including a decoder, but that is never foolproof, e.g. see this link.

    Comment

    • d3vkit
      New Member
      • Nov 2006
      • 34

      #3
      Originally posted by acoder
      Other techniques to 'hide' javascript involves encoding it and also including a decoder, but that is never foolproof, e.g. see this link.
      Doesn't compressing your js make it harder to steal? Or is there a way to decompress it? Is the compression just the encoding that you linked to?

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Originally posted by d3vkit
        Doesn't compressing your js make it harder to steal? Or is there a way to decompress it? Is the compression just the encoding that you linked to?
        Yes, it does make it harder to steal, but if someone is determined enough, he can discover your algorithm and decode or decompress the code - that's why it's not completely foolproof. Remember you have to include the decode algorithm on the page.
        For Javascript compression, you can look at this and Dojo's Shrinksafe (linked on that page).

        Comment

        Working...