0

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.

4

1 回答 1

1

更新。问题不是特定于 vue js,您应该让脚本从安全环境执行,无论是本地主机还是从 ssl 安全域。此草案涵盖了此安全问题https://wig.github.io/serial/#security

于 2020-12-08T18:01:54.653 回答