As discussed in the previous section, to be able to see how a browser will display code in a given HTML file, we normally have to open the HTML file from the browser. This process can be very time-consuming (and frustrating) if the file you want to display is buried deep inside a project directory. Let's see how PyCharm streamlines that process in the following steps:
- In PyCharm, as you hover your cursor over the top-right corner of the editor, a pop-up toolbar will appear with icons for various browsers:
Opening HTML in browsers
- Simply click on the desired browser to have the HTML file displayed. Unlike manually using a browser to open an HTML file offline, PyCharm automatically creates a local server on your machine to host the HTML code (note the URL when the HTML file is opened).
- Additionally, it is possible to configure this list of browsers available to use. Go to the PyCharm settings and navigate to Tools | Web Browsers, and you will be taken to this window:
Customizing browsers in PyCharm
From here, you can check/uncheck items in the list displayed to customize the items in the pop-up toolbar, and add in browsers that are not yet included.