使用Chrome和本地主机(不带HTTPS)的JavaScript GetUserMedia [英] JavaScript GetUserMedia using Chrome with localhost without HTTPS

查看:910
本文介绍了使用Chrome和本地主机(不带HTTPS)的JavaScript GetUserMedia的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道如何在标题中表达它,但是Chrome出现问题.

I didn't know how to express it in the title, but I'm having an issue with Chrome.

我正在尝试在Chrome中使用GetUserMedia()GetPosition().我知道除非您使用localhost,否则它首先需要SSL认证.问题是,我无法在计算机上尝试项目,因此必须使用智能手机,并且要通过智能手机访问localhost,必须使用计算机的IP地址(192.168.1.4).问题是Chrome不会将此IP地址视为localhost,因此它需要SSL证书.

I'm trying to use GetUserMedia() and GetPosition() in Chrome. I know that it requires SSL certification first, unless you're on localhost. The thing is, I can't try my project on my computer, so I must use my smart phone, and in order to access localhost through my smartphone, I must use the machine's IP address (192.168.1.4). The problem is that Chrome doesn't consider this IP address as localhost, so it requires an SSL certificate.

有什么方法可以在智能手机上测试项目而无需安装SSL证书吗?

Is there any way I can test my project on my smartphone without having to install an SSL certififcate?

推荐答案

您可以使用 https://ngrok之类的服务. com/将带有SSL证书的公共DNS地址映射到本地计算机上的端口.

You can use a service like https://ngrok.com/ to map a public DNS address with SSL certificate to a port on your local machine.

这篇关于使用Chrome和本地主机(不带HTTPS)的JavaScript GetUserMedia的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆