how to make javascript not show up in client

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maminx
    New Member
    • Jul 2008
    • 77

    how to make javascript not show up in client

    hello..

    i have a question...
    the script in javascript must be show up in client / html when we command "view source" in browser...

    but i want to hide that script so it won't show up in client/html when command "view source" in browser

    can i do that??how ?any idea?

    thanks all,,

    best regards,
    mamin
  • Brosert
    New Member
    • Jul 2008
    • 57

    #2
    Generally, you can't. You can write the code in a seperate file (using .js extension), but a determined surfer will be able to find it.
    You could unescape small portions (see http://scriptasylum.com/tutorials/en...de-decode.html)

    There are programs around that obfuscate your code, and you should be able to obfuscate your code (at least to an extent) manually as well. The simplest trick is to do the opposite of Good coding practice (ie use meaningless and indecipherable variable names, don't comment your code etc)...

    Try searching for "Obfuscate Javascript"

    Comment

    • rnd me
      Recognized Expert Contributor
      • Jun 2007
      • 427

      #3
      javascript can run, but it can't hide.

      Comment

      • maminx
        New Member
        • Jul 2008
        • 77

        #4
        Originally posted by rnd me
        javascript can run, but it can't hide.

        nice..thanks

        kind regards,

        maminx

        Comment

        • maminx
          New Member
          • Jul 2008
          • 77

          #5
          Originally posted by maminx
          nice..thanks

          kind regards,

          maminx

          hey question again....

          to not show up the javascript in client side /html is impossible, the other way is to encrypt the script, ok i agree...

          but as i follow the tutorial in this URL Obfuscate Javascript

          i must to trigger for encoding and the script must be in object so it has an id.
          I can't do that because my script is located in the bottom of body, and it doesn't have any id or attribute

          any idea??how to encrypt the script right from the page is opened, not triggered by event or attribute

          thanks


          kind regard,

          mamin

          Comment

          • rnd me
            Recognized Expert Contributor
            • Jun 2007
            • 427

            #6
            i really wouldn't bother. it wont stop me from viewing the output in the dom in firebug, and only makes tiny revisions a major PITA.

            even without firebug, i would immediately recognize the decoder as a function, and unescape the source to get the decoder. wouldn't take more than a few seconds to crack. i use 'crack' lightly, because the system doesn't even need a password.


            it also increase the size of your script files considerably.

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #7
              Why is it so important to 'hide' this code?

              See Hide JavaScript code from the client for a nice discussion on the subject.

              Comment

              Working...