#1
  1. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2002
    Posts
    607
    Rep Power
    16

    Javascript serverside?


    Hi,

    A friend of mine brought up a point that if you want to hide javascript code from the user, that you needed to make it serverside. How is this possible? I thought javascript had to be clientside?

    Can someone pls explain?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    missouri
    Posts
    165
    Rep Power
    15
    Javascript is clientside.

    I think he is referring to External Javascript. You put your Javascript in a file and give it the extension .js

    Then you put that file on your webserver along with your regular HTML pages. When building the HTML page you just reference that file by the following tag line.

    <script language="JavaScript" src="filename.js"></script>

    This will hide the JS from view when they want to hit "view source" to view your HTML page.
  4. #3
  5. Wiser? Not exactly.
    Devshed God 2nd Plane (6000 - 6499 posts)

    Join Date
    May 2001
    Location
    Bonita Springs, FL
    Posts
    6,126
    Rep Power
    4103
    There is a server-side version of javascript, but I don't think it gets used very often. Afaik, only netscapes web server supports it, and there isn't a lot of information about it either. MS also has a version called JScript which can be used with ASP.
    Recycle your old CD's



    If I helped you out, show some love with some reputation, or tip with Bitcoins to 1N645HfYf63UbcvxajLKiSKpYHAq2Zxud
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2002
    Posts
    607
    Rep Power
    16
    I had mentioned the use of the file with .js in order to hide the code from a users view.. but he said they can just view the source, find where the .js file is and bring it up in the browser to see the code.

    He said the only way to fully hide javascript code is to make it serverside.
  8. #5
  9. Wiser? Not exactly.
    Devshed God 2nd Plane (6000 - 6499 posts)

    Join Date
    May 2001
    Location
    Bonita Springs, FL
    Posts
    6,126
    Rep Power
    4103
    Yes, you can just view the source and get the url to the .js file. Making the code server-side would hide it, but server-side js cannot do what client-side js can. For example, you can't do dhtml animations with server-side js. You can't do form checking w/o reloading the page. You can't open new windows, etc.
    Recycle your old CD's



    If I helped you out, show some love with some reputation, or tip with Bitcoins to 1N645HfYf63UbcvxajLKiSKpYHAq2Zxud

IMN logo majestic logo threadwatch logo seochat tools logo