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 ⋙

Advanced SystemCare 17 Free Review 2024 - Your Best PC Optimizer

Advanced SystemCare 17 Free Review 2024 - Your Best PC Optimizer

In an era where digital efficiency is paramount, Advanced SystemCare 17 Free emerges as a beacon for those seeking to enhance their PC's performance.

Summary of Movies & TV application shortcuts on Windows 10

Summary of Movies & TV application shortcuts on Windows 10

Summary of Movies & TV application shortcuts on Windows 10, Summary of Movies & TV application shortcuts on Windows 10 to bring you a great experience. Maybe

How to fix Messages Failed to Load error on Discord for Windows

How to fix Messages Failed to Load error on Discord for Windows

How to fix Messages Failed to Load error on Discord for Windows, Discord isn't fun if you can't read what other people write. Here's how to fix Messages error

How to display the This PC icon on the Windows 11 desktop

How to display the This PC icon on the Windows 11 desktop

How to display the This PC icon on the Windows 11 desktop, During the process of using Windows 11, many users need to access This PC (management).

How to find information in the Windows Registry quickly

How to find information in the Windows Registry quickly

How to find information in the Windows Registry quickly, Do you find it difficult to find information in the Windows Registry? So below are quick ways to find the registry

How to limit the number of failed login attempts on Windows 10

How to limit the number of failed login attempts on Windows 10

How to limit the number of failed login attempts on Windows 10. Limiting the number of failed password login attempts on Windows 10 helps increase computer security. Here's how

How to create fake error messages in Windows

How to create fake error messages in Windows

How to create fake error messages in Windows, Windows can come up with some pretty creative error messages but why don't you try creating your own content for them to make fun of?

Ways to open Windows Tools in Windows 11

Ways to open Windows Tools in Windows 11

Ways to open Windows Tools in Windows 11, Windows Administrative Tools or Windows Tools are still useful on Windows 11. Here's how to find Windows Tools in Windows 11.

How to fix Windows Quick Assist not working error

How to fix Windows Quick Assist not working error

How to fix Windows Quick Assist not working error, Windows Quick Assist helps you connect to a remote PC easily. However, sometimes it also generates errors. But,

How to pin Word, Excel and PowerPoint files to the corresponding app icon on the Windows 11 taskbar

How to pin Word, Excel and PowerPoint files to the corresponding app icon on the Windows 11 taskbar

How to pin Word, Excel and PowerPoint files to the corresponding app icon on the Windows 11 taskbar, How to pin Office files to the taskbar icon on Windows 11? Invite

How to fix the error of not being able to install software on Windows

How to fix the error of not being able to install software on Windows

How to fix the error of not being able to install software on Windows, Why can't you install apps or software on Windows 10/11? Here's everything you need to know about how to fix it

Instructions for deleting or changing PIN on Windows 11

Instructions for deleting or changing PIN on Windows 11

Instructions for deleting or changing the PIN code on Windows 11, In Windows 11, the PIN code is a very useful and convenient security tool for users. However some people

How to fix There Are Currently No Power Options Available error in Windows 10

How to fix There Are Currently No Power Options Available error in Windows 10

How to fix There Are Currently No Power Options Available error in Windows 10, Can't select power mode in Windows 10, what should I do? Here's how to fix the error

The simplest way to fix Photos application errors on Windows 10

The simplest way to fix Photos application errors on Windows 10

The simplest way to fix Photos app errors on Windows 10, what should I do if Microsoft Photos doesn't work? Don't worry about ways to fix Photos app errors on Windows

Instructions for installing keyboard shortcuts to switch input languages ​​on Windows 11

Instructions for installing keyboard shortcuts to switch input languages ​​on Windows 11

Instructions for installing shortcuts to switch input languages ​​on Windows 11. During the process of using Windows, users will often have to switch between methods.

How to check supported power status on Windows 11

How to check supported power status on Windows 11

How to check power status is supported on Windows 11, Windows 11 can handle many different power states. Here's how to check the power status

How to switch from 2.4GHz to 5GHz in Windows 10

How to switch from 2.4GHz to 5GHz in Windows 10

How to switch from 2.4GHz to 5GHz in Windows 10, If you want to find a quick and simple way to speed up the Internet, changing the WiFi band from 2.4GHz to 5GHz may help.

How to fix Not Enough Memory to Run Microsoft Excel error on Windows

How to fix Not Enough Memory to Run Microsoft Excel error on Windows

How to fix Not Enough Memory to Run Microsoft Excel error on Windows, Are you having an error of not enough memory to run Microsoft Excel? So, how to fix Not Enough Memory error

Ways to find all video files on Windows

Ways to find all video files on Windows

Ways to find all video files on Windows, Can't find recorded and saved videos on PC. Below are ways to help you find all clips on Windows.

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