Search code examples
javascripthtmlhostingfilestream

Run a file:// from http://localhost/


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.


Solution

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

    apt-get install apache2
    

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

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

    Hope this helps, thanks.