我正在尝试查找流行网站中使用的 javascript 库版本。
使用 phantomjs.exe 我能够找到 jquery 的信息。但我不知道如何将其扩展到其他 Javascript 库,例如 Angular、ninject、mochajs、reactjs 和 nodejs
这里是 http://phantomjs.org/download.html 中 phanotomjs.exe 的链接
我正在附加用于 jquery 的文件。
var page = require('webpage').create(),
system = require('system'),
address;
if (system.args.length === 1) {
console.log('Usage: libdetect.js url');
phantom.exit(1);
}
page.settings.loadImages = false;
address = system.args[1];
console.log('Loading', address, '...');
page.open(address, function (status) {
if (status !== 'success') {
console.log('ERROR: Unable to load', address);
phantom.exit();
} else {
setTimeout(function () {
var jQueryVersion;
jQueryVersion = page.evaluate(function () {
return (typeof jQuery === 'function') ? jQuery.fn.jquery : undefined;
});
if (jQueryVersion) {
console.log('jQuery', jQueryVersion);
} else {
console.log('This site does not use jQuery.');
}
phantom.exit();
}, 2000);
}
});
最佳答案
对于angularjs
版本使用
angular.version
对于nodejs
版本使用
node -v
或者
node --version
关于javascript - 如何查找网站中使用的 Javascript 库版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43036093/