Barcode Scanner, NotSupportedError: Only secure origins are allowed (see:


I was trying to implement Quaggajs to facilitate barcode scanner.

I use a HTML data type to hold access the camera and a button to trigger the user camera
the doctype is as below.

but then i get this error.
any idea how to solve it? the address is shown in the image above.


i had tried the following code in desk.html

var host  = "";
if((host == && (window.location.protocol != "https:")){
window.location.protocol = "https:";

It work if i create another HTML file to test the barcode scanning.