How To Open In Browser From VS Code

If you’re using HTML, PHP, or JS files, you might want to open them in your browser from Visual Studio Code. However, there’s no integrated option to do so. This can be frustrating, especially if you want to have a quick look at the result of your coding.

How To Open In Browser From VS Code

Luckily, you can enable the “Open in Browser” function through other methods. This article will show you how to do just that.

How to Open in Browser in VS Code on a Windows PC

The easiest way to get the Open in Browser option for Visual Studio Code in Windows is to use an extension. Installing extensions in Visual Studio Code is relatively straightforward, as is using them to open files in the browser.

  1. Open your HTML file in the Visual Studio Code Editor.
    How To Open In Browser From VS Code
  2. On the far left vertical toolbar, click on “Extensions.” Alternatively, you can use the keyboard shortcut “Ctrl + Shift + X” to launch Extensions.
    How To Open In Browser From VS Code
  3. Click on the search bar to enable writing.
    How To Open In Browser From VS Code
  4. Input “open in browser.” Choose an extension that matches your search term.
    How To Open In Browser From VS Code
  5. Click the “Install” button.
    How To Open In Browser From VS Code
  6. Reload the program.
  7. Select the Explorer from the left toolbar.
    How To Open In Browser From VS Code
  8. Find your HTML file in the Explorer and right-click on it. Choose “Open in Default Browser” or “Open in Other Browsers.”
    How To Open In Browser From VS Code
  9. If you select the “Open in Default Browser” option, the HTML file will launch in whatever browser is set as default. If you choose “Open in Other Browsers,” you’ll need to specify which browser will be used.

You can find plenty of useful extensions on the Visual Studio Marketplace. Or you can get the Open in Browser extensions with the most positive user reviews here: Extension 1, Extension 2, Extension 3, Extension 4.

How to Open in Browser in VS Code on a Mac

Visual Studio Code can be upgraded using various extensions that increase the program’s functionality. One type of extension can enable opening HTML, PHP, or JS files in a default or other browser. Here’s how to enable that option on a Mac.

  1. Using the Visual Studio Code Editor, open the desired file.
    How To Open In Browser From VS Code
  2. Go to the toolbar on the left and select “Extensions.”
    How To Open In Browser From VS Code
  3. Click on the search bar in the Extensions panel and write “open in browser.”
    How To Open In Browser From VS Code
  4. Choose an extension and click on “Install.”
    How To Open In Browser From VS Code
  5. Reload the software.
  6. Go to the left toolbar and select Explorer.
    How To Open In Browser From VS Code
  7. Locate the file you want to open in the Explorer panel and right-click on it. Select either “Open in Default Browser” or “Open in Other Browsers.”
    How To Open In Browser From VS Code
  8. The “Open in Default Browser” option will launch the file using the preselected browser.  “Open in Other Browsers” will bring up a prompt where you’ll be able to choose one of the browsers installed on your machine.
    How To Open In Browser From VS Code

The Visual Studio Marketplace has a vast selection of extensions that can add new functions to Visual Studio Code. The website is well worth exploring if you wish to tweak the program further. And if you’re interested in Open in Browser extensions exclusively, here are some suggestions: Extension 1, Extension 2, Extension 3, Extension 4.

Open in Browser Shortcut

Nearly every Open in Browser extension for Visual Studio Code comes with keyboard shortcuts enabled. However, the shortcuts aren’t uniform. Instead, each extension has a particular combination of keys that will activate opening the file in your browser.

Here are the keyboard shortcuts for the extensions suggested in this article.

  1. Extension 1: “Ctrl + 1” on Windows, “Command + 1” on Mac.
    How To Open In Browser From VS Code
    How To Open In Browser From VS Code
  2. Extension 2: “Ctrl + Alt + O” on Windows, “Command + Option (Alt) + O” on Mac.How To Open In Browser From VS Code
    How To Open In Browser From VS Code
  3. Extension 3: “Ctrl + Shift + F9” on Windows, “Command + Shift + F9” on Mac.
    How To Open In Browser From VS Code
    How To Open In Browser From VS Code
  4. Extension 4: “Ctrl + Shift + P” on Windows, “Command + Shift + P” on Mac.
    How To Open In Browser From VS Code
    How To Open In Browser From VS Code

Note that these shortcuts will work only on their respective extensions linked in this article. If you choose to install a different extension, the relevant shortcuts will likely be listed on its Marketplace page.

Running HTML in Visual Studio Code

If you’re interested in working with HTML in Visual Studio Code, here are some methods of running HTML code within the program.

The first method consists of manually loading the file you wish to run.

  1. Open Visual Studio Code and create a new HTML file.
    How To Open In Browser From VS Code
  2. Go to “File,” then click “Save.”
    How To Open In Browser From VS Code
  3. Using HTML:5, activate the template for HTML. Then, open the file you saved in step 2.
    How To Open In Browser From VS Code
  4. Use the Open in Browser extension you installed previously to launch the file in your browser.
  5. Leaving the browser open, go back to Visual Studio Code and edit the HTML file, saving your changes.
    How To Open In Browser From VS Code
  6. Return to the browser and click refresh. You should see the page change based on your editing.
    How To Open In Browser From VS Code
  7. Repeat steps 5 and 6 to check your progress as you continue editing the HTML file.

The manual method can help keep track of your work. However, there’s an even better solution: auto-loading. This option will require you to install another extension, but should be well worth the time.

  1. In Visual Studio Code, go to Extensions, located at the bottom of the left toolbar.
    How To Open In Browser From VS Code
  2. In the Extensions search bar, type in “live server.”
    How To Open In Browser From VS Code
  3. Click the “Install” button next to the Live Server extension.
    How To Open In Browser From VS Code
  4. Create and save a new HTML file.
    How To Open In Browser From VS Code
    How To Open In Browser From VS Code
  5. In the Visual Studio Code Explorer, right-click on your new file. Select “Open Live Server.”
    How To Open In Browser From VS Code
  6. The HTML file will open in the browser. Once it does, try to edit the HTML code. Save your progress.
    How To Open In Browser From VS Code
    How To Open In Browser From VS Code
  7. As soon as you create a change in the code and save it, your browser should refresh, showing the new content. You won’t need to refresh the page manually and will instead be able to have visual confirmation of the changes in real time.
    How To Open In Browser From VS Code

Other Useful Visual Studio Code HTML Extensions

As mentioned, the Visual Studio Marketplace is full of excellent tools, many of which are geared towards HTML. Here are the ten most useful and best-graded extensions for HTML.

  • lit-plugin: A tool that highlights syntax, checks typing, and helps you complete the code without errors. This extension has customizable rules.
  • SCSS Everywhere: An auto-complete extension for class definitions for HTML, SCSS, Elixir, SASS, PHP, CSS, and many other file types.
  • Angular Snippets: Adds Angular snippets for easy use in HTML and TypeScript. The extension works by unfolding a snippet once it’s partially typed out.
  • ES6 String HTML: Enables es6 string code support for syntax highlighting. Works with HTML, CSS, XML, GLSL, and other formats.
  • Split HTML Attributes: This extension will split HTML attributes, as well as Angular, Vue, and React props and directives. You can use it on opening and self-closing tags, as well as on multiple selections.
  • Djaneiro – Django Snippets: An extensive snippet collection for django HTML templates. Using this extension will significantly shorten the time spent typing.
  • Live Preview: The Live Preview extension from Microsoft allows local server hosting. If you have a project that doesn’t use Angular, React, or other server tools, this extension will enable regular and embedded HTML previewing with page refreshes in real time.
  • Oracle JET Core: This extension created by the Oracle Corporation provides full support for Oracle JET custom HTML data. The included snippets will auto-complete any JET attributes and tags.
  • CSS Navigation: Enables Go to Definition for HTML to CSS, HTML to Less, and HTML to Sass. The Peek Definition command is also enabled.
  • HTML accented character converter: Seamlessly replaces special characters with appropriate HTML entities. This extension is situationally helpful, but essential when handling localizable strings.

You Can Run Visual Studio Code From Your Browser

In addition to running HTML files in a browser, it’s also possible to use the entire Visual Studio Code online. This requires you to launch a particular version of the program developed for browser use.

It’s worth noting that this version is much more lightweight compared to the desktop Visual Studio Code. However, it can be a straightforward solution for easy repository and file navigation, as well as minor code changes.

If you’d like to try out the Visual Studio Code browser variant, you can get started immediately by clicking here.

Get Your HTML Files Up and Running

Opening HTML files in your browser is made easy with the dedicated extension for Visual Studio Code. If you decide to explore the vast offerings of extensions for this coding tool, the Open in Browser function will be just the beginning of your journey.

Did you manage to open your HTML file in your browser of choice? Which extension did you use? Let us know in the comments section below.

Sign up and earn $1000 a day ⋙

How to fix error 0xa00f4288 in Camera app on Windows 10 & 11

How to fix error 0xa00f4288 in Camera app on Windows 10 & 11

How to fix error 0xa00f4288 in the Camera app on Windows 10 & 11. Windows' default Camera App is the main tool for taking photos. So in the case of Win 10 & 11 cameras

How to open multiple programs with one shortcut on Windows 10

How to open multiple programs with one shortcut on Windows 10

How to open multiple programs with one shortcut on Windows 10, You can actually open multiple programs at the same time with a single key. Here's how to use one

How to delete old boot menu options on Windows

How to delete old boot menu options on Windows

How to remove old boot menu options on Windows, Windows 10 dual boot is useful but can leave redundant boot options in the menu. Here's how to remove the menu

Instructions for fixing Snipping Tool errors on Windows 11

Instructions for fixing Snipping Tool errors on Windows 11

Instructions for fixing Snipping Tool errors on Windows 11. Windows 11 has officially been released for a while, but during use there are still many errors

Instructions for entering text by voice on Windows 11

Instructions for entering text by voice on Windows 11

Instructions for entering text by voice on Windows 11, Entering text by voice on Windows 11 helps you significantly improve your work efficiency. Here's how

How to turn on/off Sticky Key on Windows 11

How to turn on/off Sticky Key on Windows 11

How to turn on/off Sticky Key on Windows 11, Sticky Key makes the PC keyboard easier to use. Here's how to turn Sticky Key on and off on Windows 11.

What is Windows Modules Installer?

What is Windows Modules Installer?

What is Windows Modules Installer?, Windows Modules Installer sometimes takes up a lot of system resources. Is Windows Modules Installer important or not?

How to increase volume in Windows 10

How to increase volume in Windows 10

How to increase volume in Windows 10, How to increase computer volume to maximum level? Let's learn with WebTech360 how to increase Windows 10 computer volume

How to use Windows 11 Installation Assistant to install Windows 11

How to use Windows 11 Installation Assistant to install Windows 11

How to use Windows 11 Installation Assistant to install Windows 11, Windows 11 Installation Assistant is one of the best ways to upgrade your computer to Windows 11.

How to turn off the startup sound in Windows 11

How to turn off the startup sound in Windows 11

How to turn off the startup sound in Windows 11, Does the PC startup sound bother you? Then please refer to how to turn off the startup sound for PC running Windows 11 below

Instructions for changing the screen lock timeout on Windows 11

Instructions for changing the screen lock timeout on Windows 11

Instructions for changing the screen lock timeout on Windows 11. While using Windows 11, there are times when users will need to leave the computer for a period of time.

Windows 11 optimization guide to increase FPS when playing games

Windows 11 optimization guide to increase FPS when playing games

Instructions for optimizing Windows 11 to help increase FPS when playing games, Windows 11 is an operating system platform that is introduced as more improved in gaming quality, helping games

Windows 11: How to use and customize the Quick Settings menu

Windows 11: How to use and customize the Quick Settings menu

Windows 11: How to use and customize the Quick Settings menu, Windows 11 brings some great new features and the Quick Settings menu is no exception. Here it is

How to fix the error of not being able to start Windows 11 after enabling Hyper-V

How to fix the error of not being able to start Windows 11 after enabling Hyper-V

How to fix the error of not being able to start Windows 11 after turning on Hyper-V. Hyper-V helps you run virtual machines on Windows. However, after enabling Hyper-V, you cannot post again

How to fix error 0xc00007b in Windows

How to fix error 0xc00007b in Windows

How to fix error 0xc00007b in Windows, Windows displays error 0xc00007b when the application does not work properly. Below is a step-by-step guide to fix error 0xc00007b in

How to change the login screen on Windows 10/11

How to change the login screen on Windows 10/11

How to change the login screen on Windows 10/11, Don't like the blurry screen when logging in on Windows 10/11? So, instructions on how to turn off and change the login screen

How to uninstall drivers in Windows 11

How to uninstall drivers in Windows 11

How to uninstall drivers in Windows 11, Do you want to remove unwanted drivers on Windows 11? Then please see instructions on how to remove drivers in Windows

How to fix No Internet Secured error on Windows 10

How to fix No Internet Secured error on Windows 10

How to fix No Internet Secured error on Windows 10, No Internet Secured is a common error on Windows 10. Below are simple ways to fix No Internet Secured error

How to fix the error of not being able to save Excel files on Windows

How to fix the error of not being able to save Excel files on Windows

How to fix the error of not being able to save an Excel file on Windows. If you can't save the Excel file, don't worry too much. Below are ways to fix the error of not being able to save the above Excel file

How to open DMG files on Windows

How to open DMG files on Windows

How to open DMG files on Windows, DMG is a file format specific to the macOS operating system. However, you still have a way to open DMG files on Windows.