TypeError: Cannot read property 'save' of undefined
,其中“save”来自以下代码:navigator.screenshot.save(function(error,res){
if(error){
console.error(error);
}else{
console.log('ok',res.filePath);
}
});
P.S.: 我还尝试了 navigator.plugin.screenshot...
, navigator.plugins.screenshot
,
window.screenshot
, window.plugin.screenshot
和 window.plugins.screenshot
P.S.2: 我在 cordova CLI 中使用 cordova plugins
检查插件是否已安装,一切正常,插件存在于插件文件夹中,且适用于 cordova 版本>=3.0.0,我的版本更高。
但是,当然,浏览器并没有真正加载插件,因为这个错误也会在那里出现:Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:23273/www/cordova_plugins.json
。在我的智能手机上检查后发现未截取任何屏幕截图。