Начальная

Windows Commander

Far
WinNavigator
Frigate
Norton Commander
WinNC
Dos Navigator
Servant Salamander
Turbo Browser

Winamp, Skins, Plugins
Необходимые Утилиты
Текстовые редакторы
Юмор

File managers and best utilites

Keyboard Shortcuts Reference. Chrome консоль браузера


Using the Console  |  Tools for Web Developers  |  Google Developers

Kayce Basques

Technical Writer for Chrome DevTools

Andi Smith

Andi is a contributor to WebFundamentals

Meggin Kearney

Meggin is a Tech Writer

Paul Bakaus

Open Web Developer Advocate at Google • Tools, Performance, Animation, UX

Learn how to: open the DevTools Console, stack redundant messages or display them on their own lines, clear or persist output or save it to a file, filter output, and access additional Console settings.

TL;DR

  • Open the Console as a dedicated panel or as a drawer next to any other panel.
  • Stack redundant messages, or display them on their own lines.
  • Clear or persist output between pages, or save it to a file.
  • Filter output by severity level, by hiding network messages, or by regular expression patterns.

Opening the Console

Access the Console as a full-screen, dedicated panel:

The Console panel

Or as a drawer that opens next to any other panel:

The Console drawer

Open as panel

To open the dedicated Console panel, either:

  • Press Ctrl+Shift+J (Windows / Linux) or Cmd+Opt+J (Mac).
  • If DevTools is already open, press the Console button.

When you open the Console panel, the Console drawer collapses automatically.

Open as drawer

To open the Console as a drawer next to any other panel, either:

  • Press Esc while DevTools is in focus.
  • Press the Customize and control DevTools button and then press Show console.

Show console

Message stacking

If a message is consecutively repeated, rather than printing out each instance of the message on a new line, the Console "stacks" the messages and shows a number in the left margin instead. The number indicates how many times the message has repeated.

Message stacking

If you prefer a unique line entry for every log, enable Show timestamps from the DevTools settings.

Show timestamps

Since the timestamp of each message is different, each message is displayed on its own line.

Timestamped console

Working with the Console history

Clearing the history

You can clear the console history by doing any of the following:

  • Right-click in the Console and press Clear console.
  • Type clear() in the Console.
  • Call console.clear() from within your JavaScript code.
  • Type Ctrl+L (Mac, Windows, Linux).

Persisting the history

Enable the Preserve log checkbox at the top of the console to persist the console history between page refreshes or changes. Messages will be stored until you clear the Console or close the tab.

Saving the history

Right-click in the Console and select Save as to save the output of the console to a log file.

Save Console to log file

Selecting execution context

The dropdown menu highlighted in blue in the screenshot below is called the Execution Context Selector.

Execution Context Selector

You'll usually see the context set to top (the top frame of the page).

Other frames and extensions operate in their own context. To work with these other contexts you need to select them from the dropdown menu. For example, if you wanted to see the logging output of an <iframe> element and modify a variable that exists within that context, you'd need to select it from the Execution Context Selector dropdown menu.

The Console defaults to the top context, unless you access DevTools by inspecting an element within another context. For example, if you inspect a <p> element within an <iframe>, then DevTools sets the Execution Context Selector to the context of that <iframe>.

When you're working in a context other than top, DevTools highlights the Execution Context Selector red, as in the screenshot below. This is because developers rarely need to work in any context other than top. It can be pretty confusing to type in a variable, expecting a value, only to see that it's undefined (because it's defined in a different context).

Execution Context Selector highlighted red

Filtering the Console output

Click the Filter button (filter button) to filter console output. You can filter by severity level, by a regular expression, or by hiding network messages.

Filtered Console output

Filtering by severity level is equivalent to the following:

Additional settings

Open the DevTools settings, go to the General tab, and scroll down to the Console section for further Console settings.

Console settings

Setting & Description
Hide network messages By default, the console reports network issues. Turning this on instructs the console to not show logs for these errors. For example, 404 and 500 series errors will not be logged.
Log XMLHttpRequests Determines if the console logs each XMLHttpRequest.
Preserve log upon navigation Persists the console history during page refreshes or navigation.
Show timestamps Prepends a timestamp to each console message showing when the call was made. Useful for debugging when a certain event occurred. This will disable message stacking.
Enable custom formatters Control the formatting of JavaScript objects.

developers.google.com

Keyboard Shortcuts Reference  |  Tools for Web Developers  |  Google Developers

Meggin Kearney

Meggin is a Tech Writer

Kayce Basques

Technical Writer for Chrome DevTools

This page is a reference of keyboard shortcuts in Chrome DevTools.

You can also find shortcuts in tooltips. Hover over a UI element of DevTools to display its tooltip. If the element has a shortcut, the tooltip includes it.

Keyboard shortcuts for opening DevTools

To open DevTools, press the following keyboard shortcuts while your cursor is focused on the browser viewport:

Action Mac Windows / Linux
Open whatever panel you used last Command+Option+I F12 or Control+Shift+I
Open the Console panel Command+Option+J Control+Shift+J
Open the Elements panel Command+Option+C Control+Shift+C

Global keyboard shortcuts

The following keyboard shortcuts are available in most, if not all, DevTools panels.

Action Mac Windows / Linux
Show Settings ? or Function+F1 ? or F1
Focus the next panel Command+] Control+]
Focus the previous panel Command+[ Control+[
Switch back to whatever docking position you last used. If DevTools has been in its default position for the entire session, then this shortcut undocks DevTools into a separate window Command+Shift+D Control+Shift+D
Toggle Device Mode Command+Shift+M Control+Shift+M
Toggle Inspect Element Mode Command+Shift+C Control+Shift+C
Open the Command Menu Command+Shift+P Control+Shift+P
Toggle the Drawer Escape Escape
Normal reload Command+R F5 or Control+R
Hard reload Command+Shift+R Control+F5 or Control+Shift+R
Search for text within the current panel. Not supported in the Audits, Application, and Security panels Command+F Control+F
Opens the Search tab in the Drawer, which lets you search for text across all loaded resources Command+Option+F
Control+Shift+F
Open a file in the Sources panel Command+O or Command+P Control+O or Control+P
Zoom in Command+Shift++ Control+Shift++
Zoom out Command+- Control+-
Restore default zoom level Command+0 Control+0
Run snippet Press Command+O to open the Command Menu, type ! followed by the name of the script, then press Enter Press Control+O to open the Command Menu, type ! followed by the name of the script, then press Enter

Elements panel keyboard shortcuts

Action Mac Windows / Linux
Undo change Command+Z Control+Z
Redo change Command+Shift+Z Control+Y
Select the element above / below the currently-selected element Up Arrow / Down Arrow Up Arrow / Down Arrow
Expand the currently-selected node. If the node is already expanded, this shortcut selects the element below it Right Arrow Right Arrow
Collapse the currently-selected node. If the node is already collapsed, this shortcut selects the element above it Left Arrow Left Arrow
Expand or collapse the currently-selected node and all of its children Hold Option then click the arrow icon next to the element's name Hold Control+Alt then click the arrow icon next to the element's name
Toggle Edit Attributes mode on the currently-selected element Enter Enter
Select the next / previous attribute after entering Edit Attributes mode Tab / Shift+Tab Tab / Shift+Tab
Hide the currently-selected element H H
Toggle Edit as HTML mode on the currently-selected element Function+F2 F2

Styles pane keyboard shortcuts

Action Mac Windows / Linux
Go to the line where a property value is declared Hold Command then click the property value Hold Control then click the property value
Cycle through the RBGA, HSLA, and Hex representations of a color value Hold Shift then click the Color Preview box next to the value Hold Shift then click the Color Preview box next to the value
Select the next / previous property or value Click a property name or value then press Tab / Shift+Tab Click a property name or value then press Tab / Shift+Tab
Increment / decrement a property value by 0.1 Click a value then press Option+Up Arrow / Option+Down Arrow Click a value then press Alt+Up Arrow / Alt+Down Arrow
Increment / decrement a property value by 1 Click a value then press Up Arrow / Down Arrow Click a value then press Up Arrow / Down Arrow
Increment / decrement a property value by 10 Click a value then press Shift+Up Arrow / Shift+Down Arrow Click a value then press Shift+Up Arrow / Shift+Down Arrow
Increment / decrement a property value by 100 Click a value then press Command+Up Arrow / Command+Down Arrow Click a value then press Control+Up Arrow / Control+Down Arrow

Sources panel keyboard shortcuts

Action Mac Windows / Linux
Pause script execution (if currently running) or resume (if currently paused) F8 or Command+\ F8 or Control+\
Step over next function call F10 or Command+' F10 or Control+'
Step into next function call F11 or Command+; F11 or Control+;
Step out of current function Shift+F11 or Command+Shift+; Shift+F11 or Control+Shift+;
Select the call frame below / above the currently-selected frame Control+. / Control+, Control+. / Control+,
Save changes to local modifications Command+S Control+S
Save all changes Command+Option+S Control+Alt+S
Go to line Control+G Control+G
Jump to a line number of the currently-open file Press Command+O to open the Command Menu, type : followed by the line number, then press Enter Press Control+O to open the Command Menu, type : followed the line number, then press Enter
Jump to a column of the currently-open file (for example line 5, column 9) Press Command+O to open the Command Menu, type :, then the line number, then another :, then the column number, then press Enter Press Control+O to open the Command Menu, type :, then the line number, then another :, then the column number, then press Enter
Go to a function declaration (if currently-open file is HTML or a script), or a rule set (if currently-open file is a stylesheet) Press Command+Shift+O, then type in the name of the declaration / rule set, or select it from the list of options Press Control+Shift+O, then type in the name of the declaration / rule set, or select it from the list of options
Close the active tab Option+W Alt+W

Code Editor keyboard shortcuts

Action Mac Windows / Linux
Delete all characters in the last word, up to the cursor Option+Delete Control+Delete
Add or remove a line-of-code breakpoint Focus your cursor on the line and then press Command+B Focus your cursor on the line and then press Control+B
Go to matching bracket Control+M Control+M
Toggle single-line comment. If multiple lines are selected, DevTools adds a comment to the start of each line Command+/ Control+/
Select / de-select the next occurrence of whatever word the cursor is on. Each occurrence is highlighted simultaneously Command+D / Command+U Control+D / Control+U

Performance panel keyboard shortcuts

Action Mac Windows / Linux
Start / stop recording Command+E Control+E
Save recording Command+S Control+S
Load recording Command+O Control+O

Memory panel keyboard shortcuts

Action Mac Windows / Linux
Start / stop recording Command+E Control+E

Console panel keyboard shortcuts

Action Mac Windows / Linux
Accept autocomplete suggestion Right Arrow or Tab Right Arrow or Tab
Reject autocomplete suggestion Escape Escape
Get previous statement Up Arrow Up Arrow
Get next statement Down Arrow Down Arrow
Focus the Console Control+` Control+`
Clear the Console Command+K or Option+L Control+L
Force a multi-line entry. Note that DevTools should detect multi-line scenarios by default, so this shortcut is now usually unnecessary Command+Return Shift+Enter
Execute Return Enter
Expand all sub-properties of an object that's been logged to the Console Hold Alt then click Expand Hold Alt then click Expand

developers.google.com

Exception and Error Handling  |  Tools for Web Developers  |  Google Developers

Meggin Kearney

Meggin is a Tech Writer

Flavio Copes

Flavio is a Full Stack Developer

Chrome DevTools provides tools to help you fix web pages throwing exceptions and debug errors in your JavaScript.

Page exceptions and JavaScript errors are actually quite useful - if you can get to the details behind them. When a page throws an exception or a script produces an error, the Console provides specific, reliable information to help you locate and correct the problem.

In the Console you can track exceptions and trace the execution path that led to them, explicitly or implicitly catch them (or ignore them), and even set error handlers to automatically collect and process exception data.

TL;DR

  • Turn on Pause on Exceptions to debug the code context when the exception triggered.
  • Print current JavaScript call stack using console.trace.
  • Place assertions in your code and throw exceptions using console.assert().
  • Log errors happening in the browser using window.onerror.

Track exceptions

When something goes wrong, open the DevTools console (Ctrl+Shift+J / Cmd+Option+J) to view the JavaScript error messages. Each message has a link to the file name with the line number you can navigate to.

An example of an exception: Exception example

View exception stack trace

It's not always obvious which execution path lead to an error. Complete JavaScript call stacks accompany exceptions in the console. Expand these console messages to see the stack frames and navigate to the corresponding locations in the code:

Exception stack trace

Pause on JavaScript exceptions

The next time an exception is thrown, pause JavaScript execution and inspect its call stack, scope variables, and state of your app. A tri-state stop button at the bottom of the Scripts panel enables you to switch among different exception handling modes: Pause button

Choose to either pause on all exceptions or only on the uncaught ones or you can ignore exceptions altogether.

Pause execution

Print stack traces

Better understand how your web page behaves by printing log messages to the console. Make the log entries more informative by including associated stack traces. There are several ways of doing that.

Error.stack

Each Error object has a string property named stack that contains the stack trace:

Error.stack example

console.trace()

Instrument your code with console.trace() calls that print current JavaScript call stacks:

console.trace() example

console.assert()

Place assertions in your JavaScript code by calling console.assert() with the error condition as the first parameter. When this expression evaluates to false, you will see a corresponding console record:

console.assert() example

How to examine stack trace to find triggers

Let's see how to use the tools you've just learned about, and find the real cause of an error. Here's a simple HTML page that includes two scripts:

Example code

When the user clicks on the page, the paragraph changes its inner text, and the callLibMethod() function provided by lib.js is called.

This function prints a console.log, and then calls console.slog, a method not provided by the Console API. This should trigger an error.

When the page is run and you click on it, this error is triggered:

Error triggered

Click the arrow to can expand the error message:

Error message expanded

The Console tells you the error was triggered in lib.js, line 4, which was called by script.js in the addEventListener callback, an anonymous function, in line 3.

This is a very simple example, but even the most complicated log trace debugging follows the same process.

Handle runtime exceptions using window.onerror

Chrome exposes the window.onerror handler function, called whenever an error happens in the JavaScript code execution. Whenever a JavaScript exception is thrown in the window context and is not caught by a try/catch block, the function is invoked with the exception's message, the URL of the file where the exception was thrown, and the line number in that file, passed as three arguments in that order.

You may find it useful to set an error handler that would collect information about uncaught exceptions and report it back to your server using an AJAX POST call, for example. In this way, you can log all the errors happening in the user's browser, and be notified about them.

Example of using window.onerror:

Example of window.onerror handler

developers.google.com


Смотрите также

 

..:::Новинки:::..

Windows Commander 5.11 Свежая версия.

Новая версия
IrfanView 3.75 (рус)

Обновление текстового редактора TextEd, уже 1.75a

System mechanic 3.7f
Новая версия

Обновление плагинов для WC, смотрим :-)

Весь Winamp
Посетите новый сайт.

WinRaR 3.00
Релиз уже здесь

PowerDesk 4.0 free
Просто - напросто сильный upgrade проводника.

..:::Счетчики:::..