PhpStorm 2016.2 Help

Using JetBrains Chrome Extension

On this page:

Introduction

The JetBrains Chrome extension is mainly responsible for debugging JavaScript in Chrome and Dartium. During a debugging session, the extension also supports Live Editing of HTML, CSS, and other code that contains or produces JavaScript, and provides actual HTML DOM and dynamically updated source code of the actual page.

With the JetBrains Chrome extension, you can run several debugging sessions controlled by several IDEs and switch between them by changing the port which the extension listens to. And finally, the extension provides the possibility to override default CORS (Access-Control_Allow_Origin) settings and access local scripts on your machine that are by default protected.

Installing the JetBrains Chrome extension

You can install the extension during the first debugging session with Chrome or Dartium or at any time by visiting the Chrome Web Store.

To install the JetBrains Chrome extension

  1. Do one of the following:

    In either case the JetBrains IDE Support page opens where you can learn more about the extension.

  2. Click the Add to Chrome button chrome_extension_add_to_chrome.
  3. In the Confirm New Extension dialog box that opens, click Add. The Add to Chrome button changes to Added to Chrome chrome_extenstion_added_to_chrome .

When the extension is installed, the chrome_extenstion_jb_icon icon is displayed next to the Chrome address bar.

Working with JetBrains Chrome extension

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

To enable, disable, or remove the JetBrains Chrome extension

  • To open the chrome://extensions/ page, click the Customize and control Chromium button chrome_extension_control_icon next to the address bar, then choose Tools | Extensions on the context menu.
  • To deactivate the extension, clear the Enabled check box. The check box name changes to Enable.
  • To activate the extension, select the Enable check box.
  • To uninstall the extension, click the Remove from Chromium button chrome_extension_remove.

Overriding the default CORS settings

Suppose the page you are debugging requests a resource which is protected against access for security reasons through CORS settings. See more about CORS at https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS.

You can enable access to the resources protected by default 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 PhpStorm.
  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/*.

Changing port

During a debugging session, the Chrome extension listens to the port of the software product from which the extension was invoked. Each software product including PhpStorm has its own default port on which it starts by default.

If for some reason the default PhpStorm port is already busy, PhpStorm finds the closest available port and starts on it. This results in a conflict: PhpStorm is running on a "new" port while the Chrome extension still listens to the port of a previously started product and fails to establish connection with PhpStorm. The conflict reveals when you initiate a debugging session from PhpStorm: the extension fails to connect through the default port, PhpStorm waits for connection from the extension and displays the following message with the port number where it is actually running:

js_debug_install_extension.png

To fix the problem, specify the actual PhpStorm port in the Chrome extension options.

To change the port for connecting to PhpStorm

  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 PhpStorm.
  2. In the IDE Connection area, specify the actual PhpStorm port in the Port spin box.

See Also

Last modified: 24 November 2016