我们可以从任何HTML/PHP或ASP网页的源代码中隐藏javascript代码吗 [英] Can we hide javascript code from the source code of any HTML/PHP or ASP webpage

查看:153
本文介绍了我们可以从任何HTML/PHP或ASP网页的源代码中隐藏javascript代码吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

链接已删除
我不想显示一些JavaScript代码.是否有可能不允许用户看不到源代码.我的网站链接已删除

我尝试过的事情:

我想向浏览我的page的用户隐藏javascript代码.有什么办法

LINK REMOVED
I don''t want to display some of the javascript code. is it possible not to allow user not to see source code. my site LINK REMOVED

What I have tried:

i want to hide javascript code from the user who browse my page.is there any way

推荐答案

否.

Javascript以文本形式发送到浏览器:如果浏览器可以读取Java脚本,那么用户也可以阅读Java脚本,否则它根本无法正常工作.
No.

Javascript is sent as text to the browser: if the browser can read it, so can the user - or it wouldn''t work at all.


我都不喜欢任何一个答案所以我继续添加我的输入.精简JavaScript是个好主意.它使您的JS很难从别人那里读取,并且使其更小,因此下载速度更快.在大多数情况下,最小化就足够了,但是也有一些工具可以对其进行模糊处理.

我只是建议缩小代码,正如SA所说,不要将超级秘密的代码放到js中.如果您有需要与JavaScript交互的超级秘密代码,则将其放入Web服务中,然后让服务器发挥作用,然后将值传递回客户端.
I don''t like either answer so I''ll go ahead and add my input. Minifying your JavaScript is a good idea. It makes your JS very hard to read from someone and also makes it smaller so that it downloads faster. Most of the time minifying is good enough but there are tools to obfuscate it as well.

I''d just recommend minifying the code, and as SA said, don''t put super-secret code into the js. If you have super-secret code that needs to interact with JavaScript, put it into a webservice and let the server do the magic and pass back a value to the client.


并非如此.无论您做什么,最终,JavaScript都是在客户端执行的,并且可以被用户查看.您只能混淆代码,但我不会打扰.为什么不给别人所有您的客户端代码?毕竟,如果您有一些超级非法的秘密算法,则只能在服务器端使用它,而任何局外人都无法访问它.

—SA
Not really. No matter what you do, ultimately, JavaScript is executed on the client side and can be viewed by the users. You can only obfuscate code, but I would not bother. Why not giving others all your client-side code? After all, if you have some super-puper secret algorithm, use it only on the server side, where none of the outsiders can access it.

—SA


这篇关于我们可以从任何HTML/PHP或ASP网页的源代码中隐藏javascript代码吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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