如何访问Firefox的Web控制台命令历史? [英] How to access firefox web console command history?

查看:312
本文介绍了如何访问Firefox的Web控制台命令历史?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



取消devtools并按 Ctrl + Shift + I 来检查devtools本身。 b

在新的devtools窗口中,在控制台中键入以下命令:

 > 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

我该怎么办在Firefox?



我不介意命令历史记录比google chrome长。



pastebin答案只有一天好。
$ b $ pre $函数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 = tool.TargetFactory.forTab(tab || gBrowser.selectedTab);
var toolbox = gDevTools.getToolbox(target);
var panel = toolbox.getPanel(webconsole);
返回面板;
}

getWebConsolePanel();


解决方案


  1. 按F12打开开发人员工具箱(例如Web控制台),然后切换到选项面板。
  2. 启用chrome调试。

  3. 打开便签本(Shift-F4)。

  4. 复制/粘贴以下代码:
  5. 转到环境>浏览器。

  6. 选择执行>显示或检查。

现在您将看到当前所选标签页的Web控制台历史记录。


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();

解决方案

  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.

这篇关于如何访问Firefox的Web控制台命令历史?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆