At present, my .js files are within the public_html
directory. Anyone is able to type the name of these
files into their browser address bar and then be
presented the actual javascript code, which is
not desired.
Is there a Perl script which could be used which
indirectly masks/reroutes to the actual .js file
name/contents on the server (kind of like the
protection provided by NMS formmail)?
This, of course, requires keeping track of the codes in a database.
Yes, .htaccess may be a commonly used standard. But this is not a common request. If you truly want to guarantee functionality while acheiving what nube101 is asking for, .htaccess cannot help you.
Yet another option is to do it directly on the server's firewall level. But you may not have access to control that. That would be the simplest method and would guarantee that the JS is only requested along with a page.
Here am I. Thank you both.
DrDoc,
How am I to use those three lines within a .html file?
Is that a .pl file that I am to name and
upload to my cgi-bin (with chmod 755)?
What are the variable elements in the last two
lines which I am to change to suit?
htacess is not something to mess around with though if you are not experienced, one mistake in the htacess file and your site will be inaccesible to everyone. And since some hosts hide the hatcess files from view you might not be able to delete it after you upload it if you can even upload it in the first place. Check with your host if they allow you to create your own htacess files for use on your site, many do but many do not. Then find some htacess tutorials on google or other search engine and read up and make sure you understand the syntax and logic before proceeding. And htacess is really spelled htaccess, note the two cc's.
This will get you started:
[google.com...]
I urge you to read up and get educated before proceeding. htaccess is a good thing though once you learn the various ways to use.