背景:反重庆重橙网络科技有限公司的flash侵权下架的通知:
之前是使用把Flash 插件dll放入本地
操作类似:blog.csdn.net/qingyulove/… 这样打包安装后会自带插件,但是投诉就来了,一个梁上小丑,呵呵,榨取Flash最后的价值
解决办法,仿照QQ的提示用户去下载安装Flash Player
jingyan.baidu.com/article/d71…
1、在index.js主进程文件加上
try {
app.commandLine.appendSwitch('ppapi-flash-path', app.getPath('pepperFlashSystemPlugin'))
} catch (e) {
console.log(e)
}
命令行打开flash插件 如果本地没有flash ,没加try错误处理的话,会提示
所以记得错误处理。
2、在渲染进程中打开flash文件的时候,判断是否有flash 插件
let obj = navigator.plugins
console.log(obj)
this.haveFlash = false
for (var prop in obj) {
if (obj.hasOwnProperty(prop)) {
let innerObj = obj[prop]
for (let item in innerObj) {
if (innerObj[item].toString().search(/flash/i) !== -1) {
this.haveFlash = true
break
}
}
}
}
navigator.plugins返回的插件使用的所有插件,从插件中判断是否有flash ,没有的话提示下载flash Player并提示用户安装后重启软件。