#1
  1. No Profile Picture
    Senior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    151
    Rep Power
    0

    protecting javascript


    how do sites protect people from accessing their javascript?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Location
    Shimonoseki / JAPAN
    Posts
    58
    Rep Power
    12
    as far as I know they cannot. I also made some search about this issue. Basicly you cannot hide your html code - which includes your js code. Some useful tips that I have found are:

    PHP Code:
    <script scr="filename.js">
    </script> 
    this will hide your code partly but file name and path will be available, and very easy to download via getright kinda software.

    second thing is-which most of the people do- write your code in a confusing way, like instead of
    PHP Code:
    var abc ="a" 
    use something like:

    PHP Code:
    var off_TTlineCols "seconVar_2" "1122#4" "thirdVar_1"
    var abc off_TTlineCols.substr(7,1
    which will do the same thing....

    hope this helps...
    Sweet smell of a great sorrow lies over the land. Plumes of smoke rise, merge into the leaden sky. A man lies and dreams of green fields and rivers, but awakes to a morning with no reason for waking. He's haunted by the memory of lost paradise. In his youth or dream, he can't be precise. He's chained forever to a world that's departed. It's not enough, it's not enough.
    Gilmour
  4. #3
  5. No Profile Picture
    Senior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    151
    Rep Power
    0
    hm. im sure there is a way, or else people wouldnt sell javascript.

    for example,

    http://www.webreference.com/dhtml/hiermenus/

    what about putting the js files in a secure password protected folder?
  6. #4
  7. Senior Polecat
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Jersey (the original version)
    Posts
    210
    Rep Power
    12
    there is no way to consitently "hide" javascript. The best method I've seen is to not put any line breaks in the script which renders it practiccally unreadable. Unfortunately, as javascript has to be run client side it must be made visible to the browser and as such, will be accesible to anybody who has the time and effort to look for it.

    As for password protected directories - that would hide the javascript but would also stop it being downloaded by the browser - kinda defeats the point of the object!

    Icy
    Quidquid latine dictum sit, altum viditur.

    http://www.XSet.co.uk

IMN logo majestic logo threadwatch logo seochat tools logo