如何从.js代码中确定JavaScript引擎?

时间:2022-12-09 21:07:21

Is there a way using JavaScript code to know what JavaScript Engine, is the one on which that code is run on?

有没有办法使用JavaScript代码来了解运行该代码的JavaScript Engine是什么?

I don't want to get the browser type just the JavaScript engine.

我不想让浏览器类型只是JavaScript引擎。

1 个解决方案

#1


2  

See How can I detect which javascript engine (v8 or JSC) is used at runtime in Android? for some JavaScript code that uses feature detection to determine the platform.

请参阅如何在Android中检测运行时使用的javascript引擎(v8或JSC)?对于某些使用特征检测来确定平台的JavaScript代码。

Also:

也:

I think the better question is: Why do you care? You're basically falling into the "browser detection" trap that a lot of people fell into in the late 90's / early 00's. Since then, though, we've learned that it's feature detection that's the more useful approach, not least because the features supported in a given browser were (mostly) a moving target. There's code now, running on IE9 with its dramatically-improved DOM and JavaScript support, that's not using those features because it's doing browser detection and falling back on IE6 techniques.

我认为更好的问题是:你为什么关心?你基本上陷入了“浏览器检测”陷阱,许多人在90年代末/ 00年代早期陷入困境。从那时起,我们已经了解到它的特征检测是更有用的方法,尤其是因为给定浏览器支持的功能(大多数)是移动目标。现在有代码,在IE9上运行,其显着改进的DOM和JavaScript支持,不使用这些功能,因为它正在进行浏览器检测并退回到IE6技术。

from: https://*.com/a/6768595/1183010

来自:https://*.com/a/6768595/1183010

#1


2  

See How can I detect which javascript engine (v8 or JSC) is used at runtime in Android? for some JavaScript code that uses feature detection to determine the platform.

请参阅如何在Android中检测运行时使用的javascript引擎(v8或JSC)?对于某些使用特征检测来确定平台的JavaScript代码。

Also:

也:

I think the better question is: Why do you care? You're basically falling into the "browser detection" trap that a lot of people fell into in the late 90's / early 00's. Since then, though, we've learned that it's feature detection that's the more useful approach, not least because the features supported in a given browser were (mostly) a moving target. There's code now, running on IE9 with its dramatically-improved DOM and JavaScript support, that's not using those features because it's doing browser detection and falling back on IE6 techniques.

我认为更好的问题是:你为什么关心?你基本上陷入了“浏览器检测”陷阱,许多人在90年代末/ 00年代早期陷入困境。从那时起,我们已经了解到它的特征检测是更有用的方法,尤其是因为给定浏览器支持的功能(大多数)是移动目标。现在有代码,在IE9上运行,其显着改进的DOM和JavaScript支持,不使用这些功能,因为它正在进行浏览器检测并退回到IE6技术。

from: https://*.com/a/6768595/1183010

来自:https://*.com/a/6768595/1183010