How to hide your javascript code from users

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Guest

    How to hide your javascript code from users

    If one want to hide the information residing in script tag from users then that info must be written inside following comments
    <!--
    'write the code here'
    //-->
    For Example
    <html>
    <head>
    <script>
    <!
    document.write("hello");
    //-->
    </script>
    </head>
    </html>
  • naruto456
    Junior Member
    • Oct 2008
    • 9

    #2
    Its not working. wht is its adv? no need to do like this.
    wht you think about this?

    thanks

    Comment

    • trinitybrown
      Junior Member
      • Oct 2008
      • 8

      #3
      Hello cherry

      This code will not work as browser will not parse it and consider it as a comment only, then what will be use to write code in this form

      Comment

      • rudraksh
        Junior Member
        • Dec 2008
        • 4

        #4
        me too...... buddy.its not working on the browser.

        Comment

        • tobemenow
          Junior Member
          • Dec 2008
          • 9

          #5
          I think what CherryMahajan was talking about was a widely used technique of including javascript code inside htm comment tags. Why is this done? Well, some way older browsers that don't know how to interpret javascript would have displayed the code to the user who was browsing your page. The above code supplied by CherryMahajan should work very well. A good example of this method being used is the google ads script. Did you notice the html comment tags there? Well.. look again.. I always use these techniques for more than just hiding javascript code.

          Comment

          • Guest

            #6
            yes, really this method is not working in any browser, this is wrong method

            Comment

            Working...