Intellij idea has a nice "open in browser feature" that I use quite often for my static html files. Any html file can be opened in browser in two ways: 1. Idea has an internal web server that serves static content at http://localhost:63342/<relative path to content>
. 2. Via file:///<absolute path>
url.
After a recent update (14.0.2) the browser started to open pages as file:///<absolute path>
although the internal web server is still present and all I need to do is edit the url. Very annoying. I searched a lot but still can't figure out how can I influence this behaviour so all my static pages would open in browser as http://localhost:63342/<relative path to content>
By default, IntelliJ IDEA supports some of the most popular browsers, which are configured automatically, if available. In the Settings/Preferences dialog ( Ctrl+Alt+S ), select Tools | Web Browsers and Preview.
HTML IntelliJ IDEA brings powerful support for HTML that includes syntax and error highlighting, formatting according to the code style, structure validation, code completion, on-the-fly preview during a debugging session (Live Edit) or in the dedicated preview tab in the code editor, and much more.
From the main menu, select View | Open in Browser. Use the browser popup in the top right part of the editor window. Click the browser button to open the web server file URL, or Shift+Click it to open the local file URL.
Default Browser This browser will be referred to as Default in the context menu when you choose View | Open in Browser from the main menu or Open in Browser from the context menuu of a file.
Appoint the default IntelliJ IDEA browser in which IntelliJ IDEA will open HTML and JSP files upon request by default, that is, when no browser is specified explicitly For more information, see Web browsers. In this section, specify which browsers will be available for previewing HTML or JSP output.
If necessary, you can still open the page via the IntelliJ IDEA built-in web server. To do this, open the desired browser and type the URL of the file with respect to the project structure, using http://localhost:<built-in server port>/<project root> as the root URL.
In this section, specify the default IntelliJ IDEA browser that will be used by default for rendering external resources and previewing files with Web contents. This browser will be referred to as Default in the context menu when you choose View | Open in Browser from the main menu or Open in Browser from the context menuu of a file.
Viewing HTML source code of a web page in the editor. Press Ctrl+Shift+A and select Open Source Code from URL... from the list. In the Open URL dialog that opens, type the URL address of the web page or choose a previously opened URL from the list. Viewing embedded images. IntelliJ IDEA offers several ways to view images embedded in an HTML file.
Specify the server connection settings:
In the Host text box, type localhost. Use the Port spin box to specify the number of the port where the built-in web server runs. The port number should be set to 1024 or higher. By default this port is set to the default IntelliJ IDEA port through which IntelliJ IDEA accepts connections from services (63342).
Specify the folder that will be considered server document root. The folders that are under this document root in the project tree will be submitted to the PHP interpreter. The server document root folder will be accessed through HTTP at the above specified host:port.
In the Document root text box, specify the path to the relevant folder. This can be the project root or any other folder under it.
References
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With