[英]How to send a javascript file (with several functions in it) from the server to the client side?
I need to have the functionality in the server side in order to hide the implementetion to the final user.我需要在服务器端拥有该功能,以便向最终用户隐藏实现。 I didn't find a topic with this kind of solution.我没有找到这种解决方案的主题。
I have a .js file with functions I use within the html5 file.我有一个 .js 文件,其中包含我在 html5 文件中使用的函数。 The js files are "called" in the html by using the script tag, but through the url the user can track them and see the .js file content. js 文件通过使用 script 标签在 html 中“调用”,但用户可以通过 url 跟踪它们并查看 .js 文件内容。 I don't want this to happen.我不希望这种情况发生。 $getScript() does the job, but again the url can be cathched, thus the file content too. $getScript() 完成了这项工作,但同样可以捕获 url,因此也可以捕获文件内容。 Much the same with $ajax function.与 $ajax 函数大致相同。 Everything work ok, but I want to hide the js content.一切正常,但我想隐藏 js 内容。
The .js file is something like this: .js 文件是这样的:
var x, x,....
function A(){...}
function B(){...}
and so on, I use A(), B() functions in the html.依此类推,我在 html 中使用 A(), B() 函数。
Which is the best approach to get the content file from the server without doing the url visible?从服务器获取内容文件而不使 url 可见的最佳方法是什么?
Server: nodejs.服务器:nodejs。 (I send some json files through socket.io correctly, but I don't know how to achieve this other issue. (我通过 socket.io 正确发送了一些 json 文件,但我不知道如何实现另一个问题。
Thanks in advance, best!提前致谢,最好!
If you are sending sensitive information to the client then you are doing it wrong.如果您向客户发送敏感信息,那么您就做错了。 No matter if the client has the URL to the script, they will still be able to find it if they are determined as long as it is sent to their computer.无论客户端是否有脚本的 URL,只要确定了,只要发送到他们的计算机,他们仍然可以找到它。
Find a different way to accomplish what you are trying to do without sending sensitive information to the client.找到一种不同的方式来完成您正在尝试做的事情,而无需向客户端发送敏感信息。 It is not safe.它不安全。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.