如何保护客户端JAVASCRIPT

如何保护客户端JAVASCRIPT

问题描述:





我正在使用HTMl5,CSS,JavaScript编写复杂的Web应用程序,并使用AJAX调用c#webservice。我不想让它被扯掉,我想知道是否有任何方法可以保护源不被客户端看到。



我特别关注JavaScript,我想知道我是否可以通过将其托管在无法直接查看的单独文件中来保护它。

Hi,

I am writing a complex webapplication using HTMl5, CSS,JavaScript and calling a c# webservice using AJAX. I don''t want it to get ripped off, and I''m wondering if there''s any way to protect the source from being viewed in the clientside.

I am particularly concerned about the JavaScript, and I''m wondering if I can protect it by hosting it in seperate files that cannot be viewed directly.

大声朗读这些词:客户端。你不是已经听到了答案吗? :-)



如果客户端有某些东西,已经在客户端,已经客户端可以完全访问它,那就太晚了保护任何东西。你能谈什么保护?你只能让代码难以理解,这就是全部。这称为混淆。在离开服务器部分之前,有一些特殊工具可以动态地混淆JavaScipt代码。



-SA
Read these words aloud: "client side". Don''t you hear your answer already? :-)

If something is on the client side, already on client side, the already client has a full access to it, it''s too late to "protect" anything. What protection can you talk about? You can only make the code hard to understand, that''s all. This is called "obfuscation". There are special tools to obfuscate JavaScipt code on the fly, before it leaves the server part.

—SA