仅使用服务器端脚本解释Javascript代码(无浏览器)

时间:2022-04-01 15:55:17

I am currently looking to interpret Javascript code using only a server-side script (no browser). Specifically, I would like to load and use external scripts as if the server script were a browser, storing the evaluated results to a log file. It appears that something like node.js or another similar server-side Javascript library would be able to assist me in doing so. Any recommendations or suggestions?

我目前正在寻找仅使用服务器端脚本(无浏览器)来解释Javascript代码。具体来说,我想加载和使用外部脚本,就像服务器脚本是浏览器一样,将评估结果存储到日志文件中。似乎像node.js或其他类似的服务器端Javascript库这样的东西可以帮助我这样做。有什么建议或建议吗?

Thanks.

谢谢。

4 个解决方案

#1


2  

Since you need a DOM, Rhino, NodeJS, or V8 alone will not suffice. Envjs bridges the DOM gap.

由于您需要DOM,仅使用Rhino,NodeJS或V8是不够的。 Envjs弥合了DOM差距。

The goal of Envjs is to provide a highly portable javascript implementation of the Browser as a scripting environment ( often referred to as a 'headless' browser ).

Envjs的目标是提供浏览器的高度可移植的javascript实现作为脚本环境(通常称为“无头”浏览器)。

The default implementation is Rhino but many developers have and continue to develop bridges for running Envjs in Ruby, Python, and other host languages with the SpiderMonkey and V8 javascript engines, to name a few.

默认实现是Rhino,但许多开发人员已经并将继续开发使用SpiderMonkey和V8 javascript引擎运行Ruby,Python和其他主机语言的Envjs的桥梁,仅举几例。

Source

资源

See also: Bringing the browser to the server.

另请参阅:将浏览器带到服务器。

#2


1  

You should try jsdom (available as node module), or go all-in with PhantomJS, a headless browser.

您应该尝试使用jsdom(可用作节点模块),或者使用无头浏览器PhantomJS全押。

#3


0  

Depending on your server environment you can host Google's V8 JS engine: http://code.google.com/p/v8/

根据您的服务器环境,您可以托管Google的V8 JS引擎:http://code.google.com/p/v8/

Host JS in C#: http://west-wind.com/WebLog/posts/10688.aspx

在C#中托管JS:http://west-wind.com/WebLog/posts/10688.aspx

etc..

等等..

#4


0  

Rhino is a very good one.

犀牛是一个非常好的。

You can interact with it in your programs as well.

您也可以在程序中与它进行交互。

#1


2  

Since you need a DOM, Rhino, NodeJS, or V8 alone will not suffice. Envjs bridges the DOM gap.

由于您需要DOM,仅使用Rhino,NodeJS或V8是不够的。 Envjs弥合了DOM差距。

The goal of Envjs is to provide a highly portable javascript implementation of the Browser as a scripting environment ( often referred to as a 'headless' browser ).

Envjs的目标是提供浏览器的高度可移植的javascript实现作为脚本环境(通常称为“无头”浏览器)。

The default implementation is Rhino but many developers have and continue to develop bridges for running Envjs in Ruby, Python, and other host languages with the SpiderMonkey and V8 javascript engines, to name a few.

默认实现是Rhino,但许多开发人员已经并将继续开发使用SpiderMonkey和V8 javascript引擎运行Ruby,Python和其他主机语言的Envjs的桥梁,仅举几例。

Source

资源

See also: Bringing the browser to the server.

另请参阅:将浏览器带到服务器。

#2


1  

You should try jsdom (available as node module), or go all-in with PhantomJS, a headless browser.

您应该尝试使用jsdom(可用作节点模块),或者使用无头浏览器PhantomJS全押。

#3


0  

Depending on your server environment you can host Google's V8 JS engine: http://code.google.com/p/v8/

根据您的服务器环境,您可以托管Google的V8 JS引擎:http://code.google.com/p/v8/

Host JS in C#: http://west-wind.com/WebLog/posts/10688.aspx

在C#中托管JS:http://west-wind.com/WebLog/posts/10688.aspx

etc..

等等..

#4


0  

Rhino is a very good one.

犀牛是一个非常好的。

You can interact with it in your programs as well.

您也可以在程序中与它进行交互。