← All examples

JavaScript Developer & QA

On-page console panel

Captures all console calls and shows them in a scrollable panel in the corner of the page.

Code to copy

try {
  const panel = document.createElement('pre');
  panel.style.cssText = 'position:fixed;right:0;bottom:0;width:340px;max-height:240px;'
    + 'overflow:auto;z-index:99999;background:#1d2021;color:#a9b665;margin:0;'
    + 'font:11px monospace;padding:6px;border-top-left-radius:6px;';
  document.body.appendChild(panel);
  ['log', 'warn', 'error', 'info'].forEach(function (level) {
    const orig = console[level];
    console[level] = function () {
      const line = document.createElement('div');
      line.textContent = '[' + level + '] '
        + Array.prototype.map.call(arguments, String).join(' ');
      panel.appendChild(line);
      panel.scrollTop = panel.scrollHeight;
      orig.apply(console, arguments);
    };
  });
} catch (err) { console.error('JustZix console panel:', err); }

How to use this example

  1. Copy the code with the button above.
  2. Install JustZix (2 minutes) and open the extension on the target page.
  3. Add a new rule matching that page.
  4. Paste the code into the rule's JavaScript panel and save — it runs on every page visit.

Rate this example

No ratings yet — be the first.

Does this example work?

Snippets are useless without somewhere to paste them.

JustZix takes 2 minutes to install and runs your code on every matching page. No account, no payment.

Download free See use cases