First, this could look like duplicate for
How to prevent your JavaScript code from being stolen, copied, and viewed ?
And other, but it's not.
I search for ideas that can do, that stealing of JS can be very hard
Some of my examples:
- of course obfuscate code
- use a
document.location
an check if some letter in domain equals to letter on that position where script normally works - use part of this location in function call, something like eval('first_part_of_function_name'+part_from_location+'third_pard(parameters)');
- store some important constant need in application in some element in your page-design, and get it from there in JS like
$('#header div.onright a rel')
- get some portion of script by AJAX and
eval()
it - add to script some unnecessary function, instructions.
- check for existance of some elements in page (copyright text on footer)
- generate some time-variable hash in PHP and put in JS, where will be function that checks this hash and current time to work or not
- maybe use of other JS files ? or events binded to elements hidden in very common scripts (like bind some action in jquery-min.X.X.X.js file where all jquery is.
Are they good ideas ? Have some more ? I think that most important can be variety of things wich you can do with document location, is that the only element that will be driffrent than working in normal coditions on our site ?