Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij idea opens static pages in browser with different url formats

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>

like image 228
user3468781 Avatar asked Dec 16 '14 05:12

user3468781


People also ask

How do I change my default browser in IntelliJ?

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.

Can you use IntelliJ for HTML?

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.

How do I run a web app locally in IntelliJ?

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.

Does IntelliJ have a browser?

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.

How do I preview JSP and HTML files in IntelliJ IDEA?

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.

How do I open a page in IntelliJ IDEA?

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.

What is the default browser in IntelliJ IDEA?

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.

How to view embedded images in IntelliJ IDEA?

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.


1 Answers

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

  • Idea Docs: Built-in Web Server
like image 96
Paul Sweatte Avatar answered Nov 15 '22 10:11

Paul Sweatte