You are viewing extension docs in chrome via the 'file:' scheme: are you expecting to see local changes when you refresh? You'll need run chrome with --allow-file-access-from-files.
WARNING: This is the BETA documentation. It may not work with the stable release of Chrome.
WARNING: This is unofficial documentation. It may not work with the current release of Chrome.

Google Chrome Extensions (Labs)

chrome.experimental.devtools.console API

For information on how to use experimental APIs, see the chrome.experimental.* APIs page.

chrome.experimental.devtools.console API

Use chrome.experimental.devtools.console to retrieve messages from the inspected page console and post messages there. getMessages() returns the list of messages on the console, onMessageAdded event provides notifications on new messages, and addMessage() allows an extension to add new messages.

API reference: chrome.experimental.devtools.console

Methods

addMessage

chrome.experimental.devtools.console.addMessage(Severity severity, string text)

Adds a message to the console.

Parameters

severity
( Severity )
The severity of the message.
text
( string )
The text of the message.

getMessages

chrome.experimental.devtools.console.getMessages(function callback)

Retrieves console messages.

Parameters

callback
( function )
A function that receives console messages when the request completes.

Callback function

The callback parameter should specify a function that looks like this:

function(array of ConsoleMessage messages) {...};
messages
( array of ConsoleMessage )
Console messages.

Events

onMessageAdded

chrome.experimental.devtools.console.onMessageAdded.addListener(function(ConsoleMessage message) {...});

Fired when a new message is added to the console.

Listener parameters

message
Undocumented.

Types

ConsoleMessage

( object )
A console message.
severity
( Severity )
Message severity.
text
( string )
The text of the console message, as represented by the first argument to the console.log() or a similar method (no parameter substitution performed).
url
( optional string )
The URL of the script that originated the message, if available.
line
( optional number )
The number of the line where the message originated, if available.

Severity

( object )
Undocumented.
Tip
( string )
Undocumented.
Debug
( string )
Undocumented.
Log
( string )
Undocumented.
Warning
( string )
Undocumented.
Error
( string )
Undocumented.