I am not even sure if this is possible but I decided try it out anyways. I have a certain javascript file that I want to let me display the contents of on their website. I am giving them this code so that they can easily add the contents: <script type="text/javascript" src="http://www.website.com/thefile.js"></script> Code (markup): However, I don't want people to be able to actually go directly to http://www.website.com/thefile.js and get codes that are in the file. Is it possible for me to protect myself against this? I want people to be able to display the information on their website, but not be able to see the javascript coding. Please and thank you
If you want the browser to be able to run the JS then people will be able to see it, about the best you can do is use a JavaScript compressor/obfuscator to make the code hard to read.
compress the JS is the way and the only way to go. You can compress the JS on the fly or compress it when every time it changes