PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, October 16, 2022

[FIXED] How to access firefox web console command history?

 October 16, 2022     firefox, google-chrome     No comments   

Issue

It is fairly easy to access the last 30 (!) javascript console commands in Google Chrome devtools:

Undock devtools and press Ctrl+Shift+I in it to inspect devtools itself.

In that new devtools window, type following commands in the console:

> location.origin
"chrome-devtools://devtools"
> JSON.parse(localStorage.consoleHistory).join('\n')
"inp.style.backgroundColor = "rgb(250, 0, 250)"
inp.style.backgroundColor = "rgb(250, 255, 250)"
...
inp.style.backgroundSize
inp.style.backgroundColor"
> JSON.parse(localStorage.consoleHistory).length
30

How can I do the equivalent in Firefox?

I wouldn't mind if it had a longer command history than google chrome.

That pastebin answer was only good for a day. So here it is again, thanks @msucan!

function getWebConsolePanel(tab) {
    var gDevTools = Cu.import("resource:///modules/devtools/gDevTools.jsm", {})\
.gDevTools;
    var tools = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).dev\
tools;
    var target = tools.TargetFactory.forTab(tab || gBrowser.selectedTab);
    var toolbox = gDevTools.getToolbox(target);
    var panel = toolbox.getPanel("webconsole");
    return panel;
}

getWebConsolePanel();

Solution

  1. Press F12 to open the developer toolbox (eg. the web console), then
  2. Switch to the Options panel.
  3. Enable chrome debugging.
  4. Open Scratchpad (Shift-F4).
  5. Copy/paste this code: https://pastebin.mozilla.org/3757211
  6. Go to Environment > Browser.
  7. Pick Execute > Display or Inspect.

And now you will see the web console history for the currently selected tab.



Answered By - msucan
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing