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.

Peyton Hanel
  • 374
  • 1
  • 3
  • 13

1 Answers1

1

UPDATED. The problem is not specific from vue js, you should make the script execute from a secure environment, either localhost or from a ssl secured domain. This security concerns are covered on this draft https://wicg.github.io/serial/#security.

alvezgr
  • 11
  • 2
  • Try to be more specific on how your answer solves the user question. The problem is that the script is not comming from a secure enviroment, either localhost or from a ssl secured domain and for security concerns it is not allowed to be executed, this security concerns are indeed covered on the document you've attached. – yuri Dec 11 '20 at 11:54
  • 1
    Thank you @yuri. I updated my answer and I'll be more specific from now on. – alvezgr Dec 11 '20 at 14:22