如何使用记事本保护JavaScript中的源代码 [英] How to protect source code in javascript using notepad

查看:69
本文介绍了如何使用记事本保护JavaScript中的源代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我已经使用记事本在javascript中编写了代码,该记事本可以读取Excel数据并将其绘制在Google地图上.我想保护我的代码以供查看.我该怎么做.
谁能帮我修复它.
在此先谢谢您.

Hi all,
I have made the code in javascript using notepad which read excel data and plot it on google maps. I want to protect my code to be viewed. How can i do this.
Can anyone help me to fix it.
Thanks in advance.

推荐答案

您不能阻止查看客户端Javascript.没门.期间.

好吧,要合乎逻辑.有人以客户身份打开了一个网页.目前,它已经在客户端的客户计算机上.您的服务器再也无法访问它,无法控制.您知道HTTP和Web如何工作吗?

与记事本无关. :-)

—SA
You cannot prevent viewing your client-side Javascript. No way. Period.

Well, be logical. Somebody opened a Web page as a client. At this moment, it is already on the client side, on the computer of your customer. Your server has no access to it anymore, no control. Do you have any idea how HTTP and Web works?

There is nothing to do with Notepad. :-)

—SA


正如SA所说,您不能这样做:由于Javascript代码是在客户端执行的,因此它以源代码的形式完整传输每次页面加载时向客户端发送.

为了证明这一点,请用浏览器右键单击此页面:您将看到一个选项查看源代码"或查看页面源代码".如果选择它,您将获得在此页面或任何其他页面上运行的活动Javascript的完整副本.不管使用哪种浏览器,它们都具有AFAIK.
As SA says, you can''t do it: Since Javascript code is executed at the client, it is transferred in full in source code form to the client each time your page loads.

To prove it, right click this page with your browser: You will see an option "View Source" or "View Page Source". If you select it, you will get a full copy of the active Javascript that runs on this page, or any other. It doesn''t matter which browser you use, they all have it AFAIK.


您无法阻止它,但是会使其变得有点难看或不易查看.

制作一个javascript专用文件. * .js文件,然后在其中编写代码.在您的网页中,参考文件.
内部一切正常.

实际上,该文件是在客户端计算机上的Internet临时文件夹中下载并使用的.对于新手或懒惰的用户,JavaScript代码将不可见,并且您可能会避开一些.

此外,您可以压缩javascript文件,使其不友好阅读.人们需要努力才能理解和破译它.
You cannot prevent it but you can make it a little difficult or not easy to view.

Make a javascript specific file. *.js file and then write your code in it. In your webpage, refer the file.
Internally everything works fine.

In actual, the file is downloaded on client machine in the temporary internet files folder and used. For novice or a lazy user, the javascript code would not be visible and you might get away from few.

Further, you can compress the javascript file such that it''s not reading friendly. One would need effort in order to understand and decipher it.


这篇关于如何使用记事本保护JavaScript中的源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆