Here is an example:
I have a file 1.js, which has some functions. I have to make them available to another file 2.js.
1.js is not included in the page, but 2.js is (using src=”).
Is there a way to do this? I do not want to expose 1.js at all to the users, but want to use its functions in 2.js
Description
JavaScript works on the client (Browser) so you have to make the file available to them.
Consider to encode and minify the file to make it harder to read.
More Information
Online Javascript Compression Tool
JavaScript Compressor – Compress JavaScript Code Online for Free
HTML/text/JavaSript Escaping/Encoding Script
Free Javascript Obfuscator – Protects JavaScript code from stealing and shrinks size
Update
You can do a Ajax call to get the javascript and use
eval. I would do it this way using jQuery .load().It is possible to include a javascript-file using javascript like this
}
Then you can call methods from the other script / source. But this is visible to the user and experienced users will find this.
Its harder to find as a simple