2017-03-27 37 views
1

我正在嘗試查找熱門網站中使用的JavaScript庫版本。如何查找網站中使用的Javascript庫版本?

使用phantomjs.exe我能夠找到jQuery的信息。但我不知道如何擴展它的其他JavaScript libaries像角,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); 
 
    } 
 
});

+0

通常,版本號位於評論文件的頂部。你是否想要一種方法來編寫這樣做的腳本,或者你在問如何手動查找版本號? – 4castle

+0

@ 4castle:我想通過腳本/命令來做到這一點,而不是手動 – Angelah

回答

0

angularjs版本使用

angular.version 

對於nodejs版本使用

node -v 

或者

node --version 
相關問題