google-chrome - Chrome Web Serial API not working in VueJs Web app
问题描述
I'm developing an enterprise web app with Vue.js, and I would like to use the Web Serial API in Chrome. On the linux machine that I'm developing on, I went to this Chrome flag chrome://flags/#enable-experimental-web-platform-features
and enabled it. Then I did console.log('serial' in navigator)
and it returned true, meaning that the flag is enabled. All is good so far.
So I went and did the same thing on the corporate computer I need to be using (running windows 10). I enabled the flag in Chrome, restarted it, and ran console.log('serial' in navigator)
on the tab running the web app, but it returns false, which is bad because I need it to be true. But when I run that code on a different tab, it returns true. How could my web app be changing the navigator? So I can't use the Web Serial API on the one computer that needs to be using it and I don't know why.
Any help is appreciated.
解决方案
更新。问题不是特定于 vue js,您应该让脚本从安全环境执行,无论是本地主机还是从 ssl 安全域。此草案涵盖了此安全问题https://wig.github.io/serial/#security。
推荐阅读
- gwt - SmartGWT MenuItem 显示检查 canSelect(false)
- sql - 用于将查询结果导出到 Excel 的 MS Acess 按钮
- postgresql - PostgreSQL 和巨大的数组
- node.js - 使用节点 js 和反应 js 上传图像时获取错误的图像 URL
- c++ - 带有参数对象的 C++ 裸函数
- mysql - MySQL - 存储与另一个表的关系,该表保留可以更改的顺序
- python-3.x - snakemake 蛇文件中的语法错误
- sql - 2003 年访问的条件标准
- django - Django [创建具有特定权限的用户]
- java - 在 Java 代码中输入小数时出现编译错误