开发者

Javascript js file encoding [duplicate]

开发者 https://www.devze.com 2023-04-05 00:54 出处:网络
This question already has answers here: 开发者_开发知识库Closed 11 years ago. Possible Duplicate:
This question already has answers here: 开发者_开发知识库 Closed 11 years ago.

Possible Duplicate:

How can I obfuscate JavaScript?

Hi I need to Encode my js file to upload my host when save my page i dont want user see my js and my javascript code any body idea


you can't encrypt or encode your JS as the browser needs to run it.

The only thing you can do is to minify it, so it gets hard do read. But someone with the right tools and time will be able to reconstruct the code.


Hi there is no way to encript a js page, but there are a few tricks you can do to obscure te code.

First, you obscure the code, by changing the variable to value that do not make much sense. If you do that, keep a original copy. ie.:

var firstname = 'Paul'; // change it to var fn = 'Paul'; or var 00110011 = 'Paul';
function returnFirstname(){} // change it for rtnFN011010(){}

In order to do that, you would need to program a script that does it for you.

Second, minify your code : http://fmarcia.info/jsmin/test.html

Good luck


The is no definitive way to do this, the best you can do is minify your js file. Search Google for "JavaScript Minify", there are plenty of tools out there...

0

精彩评论

暂无评论...
验证码 换一张
取 消