使用js检测页面是在electron app中运行还是在浏览器中运行

<script type="text/javascript">
   var userAgent = navigator.userAgent.toLowerCase()
   if (userAgent.indexOf(' electron/') > -1){
      执行条件代码。。。。。。。。。。。
   }
</script>
原文地址:https://www.cnblogs.com/yinliang/p/11858500.html