IntelliJ IDEA 2017.3 Help

Live Edit in HTML, CSS, and JavaScript

This feature is only supported in the Ultimate edition.

IntelliJ IDEA provides a Live Edit functionality that lets you preview the changes to your HTML, CSS, or JavaScript code on the fly during a debugging session. The live contents of the page you edit are shown in the Elements tab of the Debug tool window.

Live Edit works through the JetBrains Chrome extension and therefore is available only in Google Chrome.

Before you start

Install and enable the LiveEdit plugin. The plugin is not bundled with IntelliJ IDEA, but it can be installed from the JetBrains plugin repository as described in Installing, Updating and Uninstalling Repository Plugins and Enabling and Disabling Plugins.

Installing the JetBrains Chrome Extension

The JetBrains Chrome extension is responsible of Live Edit in HTML, CSS, and JavaScript during a debugging session. The extension also shows the DOM tree and the source code of the actual page.

To install the JetBrains Chrome extension

  1. Open the JetBrains IDE Support page in Chrome Web Store.
  2. Click the Add to Chrome button chrome extension add to chrome, and then click Add in the Confirm New Extension dialog box that opens. The Add to Chrome button changes to Added to Chrome chrome extenstion added to chrome.

Activating Live Edit

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), click Debugger under Build, Execution, Deployment, and then click Live Edit. The Live Edit page opens.
  2. Select the Update application in Chrome checkbox. This enables on-the-fly preview of HTML and CSS.
  3. To enable Live Edit in JavaScript, select the Update on changes checkbox.
  4. Set the elapsed time for applying the changes to a running application: accept the default value 300 ms or specify a custom value using the spin box next to the corresponding field.
  5. To configure highlighting, select the Highlight current element in browser on caret change checkbox. Otherwise, during a debugging session, you will have to hold Shift and click the element to highlight.
  6. To have IntelliJ IDEA restart the server if automatic upload of changes to the client-side code fails, select the Restart if hotswap fails checkbox. See

Activating, de-activating, and uninstalling JetBrains Chrome extension

Control over the JetBrains Chrome extension is provided through the chrome://extensions page:

  • To open the page, just type chrome://extensions in the Chrome address bar.
    Alternatively click Customize and control Google Chrome (chrome extension control icon), choose Settings on the context menu, and then click Extensions on the chrome://settings page that opens.
  • To deactivate the extension, clear the Enabled checkbox. The checkbox name changes to Enable.
  • To activate the extension, select the Enable checkbox.
  • To uninstall the extension, click the Remove from Chrome button chrome extension remove.

Changing the default port for connecting to IntelliJ IDEA

During a debugging session with Live Edit, the Chrome extension listens to the port of the JetBrains IDE from which the extension was invoked. Each IDE including IntelliJ IDEA has its own default port on which it starts.

If for some reason the default IntelliJ IDEA port is already busy, IntelliJ IDEA finds the closest available port and starts on it. This results in a conflict: IntelliJ IDEA is running on a "new" port while the Chrome extension still listens to the port of a previously started product.

The conflict reveals when you initiate a debugging session with Live Edit: the extension fails to connect through the default port, IntelliJ IDEA waits for connection from the extension and displays the following message with the port number where it is actually running (for example, current port 63343):

js_debug_install_extension.png

To fix the problem, specify the actual IntelliJ IDEA port in the Chrome extension options

  1. Right-click chrome extenstion jb icon and choose Options on the context menu. A web page with the Chrome extension options opens showing the parameters to connect to IntelliJ IDEA.
  2. In the IDE Connection area, specify the actual IntelliJ IDEA port in the Port spin box.

Overriding the default CORS settings

Suppose the page you are debugging with Live Edit requests a resource which is, for security reasons, protected against access through CORS settings. You can enable access to the protected resources by changing the Chrome extension options.

To override the default CORS settings

  1. Right-click chrome extenstion jb icon and choose Options on the context menu. A web page with Chrome extension options opens showing the parameters to connect to IntelliJ IDEA.
  2. In the Force CORS text box, type the pattern that defines the URL addresses you want to make accessible, for example: http://youtrack.jetbrains.com/rest/*.

Last modified: 12 December 2017

See Also