从http://localhost/运行文件:// [英] Run a file:// from http://localhost/

查看:75
本文介绍了从http://localhost/运行文件://的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使我的.html项目不是从file://而是作为本地主机运行,因为我实现的功能之一需要getUserMedia,当从file://加载时,浏览器会立即阻止它.我对此进行了很多研究,但是我仍然不知道应该怎么做,因此,如果可以的话,请当然详细解释一下.

I wonder to know how can I make my .html project run not from file:// but as a localhost because one of the functions I've implemented requires getUserMedia which browsers instantly block, when loading from file://. I've done a lot of research on this but I'm still not understanding how it should be done, so if you can, please explain it in detail if it's not too pretentious of me, of course.

推荐答案

如果您使用的是Ubuntu(或其他类似的Linux发行版),请运行

If you are on Ubuntu (or any other similar Linux distro) run

apt-get install apache2

然后将文件移动到/var/www/html文件夹,并在浏览器中导航到localhost.

then move your files to the /var/www/html folder, and navigate to localhost in your browser.

在Windows上,您可以安装 XAMPP ,然后将文件移动到 \中的安装位置.htdocs 文件夹

On Windows, you can install XAMPP, then move your files to wherever you installed it to in the \htdocs folder

希望这会有所帮助,谢谢.

Hope this helps, thanks.

这篇关于从http://localhost/运行文件://的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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