You might need to launch Chrome on Visual Studio Code for many reasons. For example, you might want to quickly test one of your HTML, CSS, SASS, or JavaScript files. This guide will demonstrate running a simple HTML file in Chrome using VS Code.
Step 1: Install the Live Server extension
Live Server is an extension that allows you to run HTML code as a web application running on your localhost web server directly from your machine. It also reloads your page automatically every time you save the file. Follow these steps to install Live Server:
- From the sidebar, select Extensions.
- Type “Live Server” in the search box and click the Install button.
Step 2: Set the default browser
By default, Live Server opens the default browser of the machine. If you want to specify custom browser settings for Live Server, follow these steps:
- From the sidebar, click on the Manage button. Then, select the Settings option from the menu. Alternatively, you can press Ctrl +,
- In the “Search Settings” bar, type Live Server.
- From the Custom Browser option, select the browser you want for the Live Server – we’ll select “chrome” for this guide.
Step 3: Run the code in Chrome
To run an HTML file in Chrome using VS Code, follow these steps:
- Open the existing HTML file you want to run in VS Code. In my case, I have opened a demo HTML file named “index.html.”
- From the Status bar on the bottom-right corner of VS Code, click on the Go Live button.
- The browser will open the webpage with the HTML structure.
There it is! This is the process to launch Chrome on Visual Studio Code using the Live Server extension. Make sure to follow the same process to launch Chrome for other programs like JavaScript, SASS, and CSS.
great