29

I don't wish to disable my extensions – after all they're there for development purposes – but I want to disable their output from the console in Web Inspector. Is there a way to do this?

N.B. a very similar question has been asked on StackOverflow, but it seems that question and its answers are leaning towards disabling extensions, which is not what I want (since I obviously use them for development) – I simply want to suppress their output from the console.

enter image description here

1
  • 2
    6 year later and they refuse to fix this issue, best you can do is set a filter each time you load devtools
    – nodws
    Aug 17, 2018 at 20:00

6 Answers 6

1

To add to @jarodjacob's answer:

The "right-click and filter" method (right-clicking the white blank part of a console message and choosing "Hide Messages from X") adds a -url:xxx filter to the filter box, with the full URL of the log's source file.

However, the URL used in a -url:xxx filter doesn't have to be the full URL: -url:chrome-extension:// will hide almost everything that includes chrome-extension:// in the source URL. This will hide all regular logs from all extensions (warnings generated by the browser instead of being logged with the console object are not filtered).

The same behavior applies: the filter is kept until manually removed.

(Please note that this behavior was likely added after other answers were posted, which would mean it was not possible to do this at the time. Exact methods have also changed.)

17

Firefox has a way to change the console logging level for specific extensions from about:config.

Chrome doesn’t have this capability. Your options:

  1. Filter out all messages from a particular source file by right-clicking the white (blank) part of console message line and choosing Filter > Hide Messages from foo.js. You can undo this filtering from the same menu later, if you wish. Chrome will remember to do this filtering for you until you disable it (even if you navigate somewhere else or restart Chrome).
  2. Override one or more console methods. This approach only affects the current scripting context. Chrome extensions run in their own isolated worlds with their own window objects, global scopes, and console objects. If you can’t edit the source code of the extension, you’ll need to paste and run your console-altering scripts in each extension’s execution context, and your modifications will only be in effect until the page is unloaded. You can change the console’s effective execution context using the dropdown at the bottom of the console that says <page context>. Note that any frames or iframes in the page also have their own execution contexts, accessible using the frame dropdown (initially set to <top frame>).
2

Just temporarily disable the extensions.

This will add a button to your browser and it will only require two clicks to toggle your extensions.

4
  • 2
    That's a nice tip (thanks!), however if you prefer to use the extensions while developing, it's awkward having to disable them just to get a clean console.
    – Henrik
    Jun 8, 2012 at 1:04
  • 1
    @hced: Another approach which might work is running in incognito mode and allow the extensions you need for developing in incognito. Yet another approach is creating a separate user profile for developing. From your screenshot it only appear to be two bad extensions, perhaps you can just disable those and/or find alternatives. In any case, a lot of options to try; and if you really want it, raise a feature request at Google Chrome and hopefully one day it'll be available for all developers... Jun 8, 2012 at 1:42
  • This is not a solution. I am on jsfiddle, programming at night. I want my high-contrast extension to invert the colors, but I don't want to see its output. There are other examples too. There really should be a way to suppress just the console ouput....
    – Jonah
    May 29, 2013 at 11:09
  • @Jonah: Correct your extension to not output to the console. May 29, 2013 at 14:42
1

This is currently not possible, but there is an ongoing feature request for it (or, rather, for the same problem happening on the Network inspector tab). "Star" it to help make it happen :)

https://code.google.com/p/chromium/issues/detail?id=239401

1
1

I found a simple way to hide extension logs in Chrome. just use console filter with following parameter

-source:other

example

5
  • Thank you Hoxz. Love getting answers 11 years after asking :-)
    – Henrik
    Apr 27, 2023 at 21:45
  • 1
    @Henrik For future generations :)
    – Hoxz
    Apr 28, 2023 at 17:27
  • For me, this hides Chrome's source map failure logs, and not the extension logs. Jul 26, 2023 at 18:15
  • @DarrylNoakes you can try to exclude messages by url. Like -url:chrome
    – Hoxz
    Jul 27, 2023 at 13:35
  • @Hoxz Yes, as I stated in my answer. Jul 27, 2023 at 18:09
0

Another approach is loading the window in cognito, which by default ignores your extensions

Press (cmd or ctrl) + shift + n to load a private browsing session.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .