Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Introduction to Programming Basics Writing Your Program

Ranjen Naidu
Ranjen Naidu
2,474 Points

how to setup the html file in localhost

Hi ,

can you guide me how to create the index.html file in my localhost? how to make the index and javascript file connected in my web browser via http://localhost ?

For example :

When i search localhost/index.html in the browser it should display from index.html file in my computer.

6 Answers

Hi Ranjen!

Probably! If you follow that video, you don't really want to use localhost yet. First, install notepad++ in your Windows 7, then create a webpage index.html, after create another for myscript.js. After all, run it in your browser as Chrome, then Press ( Ctrl+ Shift+ J), and you will see the code and a header click on console you will see your JavaScript you already create.

If you still need the localhost you can download WAMPSERVER for Windows and XAMPP for OS.

Nkosi Ndlovu
Nkosi Ndlovu
9,652 Points

Probably the easiest way is with xampp. What OS you on?

Ranjen Naidu
Ranjen Naidu
2,474 Points

Windows 7, okay i will try installing that, thanks :-)

I don't think you need to setup a local host for such simple exercise

I have windows 8, I write my index.html and myscript.js on the notepad and I save them in one folder on the desktop. Then right click on the index.html file that you have saved. It is asked open with. You choose Google Chrome.

Peter Van der Lely
Peter Van der Lely
6,342 Points

Hi there,

All in all you write and save your webfiles with the help of an editor like notepad or TextPad or Brackets (free download from brackets.io) or tons of others. When you save this like index.html in a directory on your C: drive with the name of localtreehouse, you open the index.html file with the help of your Chrome browser and it's 'URL' will show as: file:///C:/locolhosttreehouse/index.html. Now by opening the developer tools of your Chrome browser will bring you in sync with the video.

Regards Peter