简体   繁体   English

从NodeJS服务器发送JS脚本给客户端执行,客户端看不到JS脚本

[英]Send JS script from NodeJS server to client a execute it, the client cannot see JS script

I want to send JS script from NodeJS to a client and execute it in such a way that the client does not see the JS script.我想将 JS 脚本从 NodeJS 发送到客户端并以客户端看不到 JS 脚本的方式执行它。 Can I do it this way?我可以这样做吗?

  1. generate some JS script on NodeJS server在 NodeJS 服务器上生成一些 JS 脚本

  2. send JS script to client向客户端发送JS脚本

  3. execute JS script on client-side在客户端执行 JS 脚本

But with a little detail the client cannot see the JS script.但是有一点细节,客户端无法看到 JS 脚本。

Probably you can use eval(response.data) to run your response from the nodejs server.也许您可以使用 eval(response.data) 从 nodejs 服务器运行您的响应。 Even if client cannot see the script in the contents .. it will be on the network calls tab.即使客户端看不到内容中的脚本......它也会在网络调用选项卡上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM