Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run html file on localhost?

I have a html file and i run it on localhost. But, this file includes mirror using webcam. Example, how can i run this html file on localhost? Webcam starting on this example when check to live checkbox. Thanx for your reply.

like image 394
Volkan Şahin Avatar asked Jul 21 '16 07:07

Volkan Şahin


People also ask

How run NPM in localhost HTML?

To run HTML file on localhost, we can use the http-server Node module. First, we install Node. js in our system. Then In CMD, run the command npm install http-server -g .


2 Answers

You can run your file in http-server.

1> Have Node.js installed in your system.

2> In CMD, run the command npm install http-server -g

3> Navigate to the specific path of your file folder in CMD and run the command http-server

4> Go to your browser and type localhost:8080. Your Application should run there.

Thanks:)

like image 81
Clinton Roy Avatar answered Sep 21 '22 11:09

Clinton Roy


You can use python -m http.server. By default the local server will run on port 8000. If you would like to change this, simply add the port number python -m http.server 1234

If you are using python 2 (instead of 3), the equivalent command is python -m SimpleHTTPServer

like image 36
Nora Avatar answered Sep 21 '22 11:09

Nora