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
- Press F12 to open the developer toolbox (eg. the web console), then
- Switch to the Options panel.
- Enable chrome debugging.
- Open Scratchpad (Shift-F4).
- Copy/paste this code: https://pastebin.mozilla.org/3757211
- Go to Environment > Browser.
- 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)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.