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

    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    5
    Rep Power
    0
    Hi,

    I'm trying to hide the code in a Javascript file so that it does not appear when a user views the source in their browser. This is how it's normally done (below). But this does not stop the user calling the "validation.js" file directly from the URL location. When I stop access to this file via the apache <Directory> or <Location> directive, then it does not get served even to the JavaScript Engine. It is a case of ALL or NOTHING.

    Anyway out of this dilema ? I would appreciate your feedback.

    Thanks,
    Moh'd

    document.write('<Script Language="JavaScript" Src="http://www.foo.com/validation.js"></Script>');
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    18
    JS is run client side and therefore has to be sent to the client to run, just like you have to send the HTML to the client for it to be displayed.

    If you really don't want the user to see your validation process, you'll need to use server side validation scripting using PHP, Perl or some other server side language.

IMN logo majestic logo threadwatch logo seochat tools logo