相关疑难解决方法(0)

在Firefox,Greasemonkey脚本中使用时,console.log不起作用

我的用户脚本使用打印一些信息console.log().

这在Chrome中运行良好,但是当我在Firefox(Greasemonkey)中安装此用户脚本时,Firefox中的Web控制台无法显示任何内容.

我搜索了一个解决方案,有些人建议使用,unsafeWindow但它也没有显示任何输出.而且unsafeWindow不能用于镀铬.我甚至安装了Firebug,但没用.我该如何解决这个问题?

例如,我在Firefox中试过这个用户脚本:

// ==UserScript==
// @name        console
// ==UserScript==
console.log("hello");
Run Code Online (Sandbox Code Playgroud)

firefox greasemonkey userscripts

13
推荐指数
2
解决办法
2万
查看次数

setTimeout并不总是在Greasemonkey中工作

我发现了很多类似的问题,但没有一个问题,没有正确的解决方案.这是一个非常奇怪的问题.

我有一个简单的Greasemonkey脚本来测试问题:

// ==UserScript==
// @name        testdiddio
// @namespace   http://userscripts.org/users/useridnumber
// @include     https://www.google.it/
// @version     1
// ==/UserScript==


function wait(){
    console.info("wait");
    setTimeout(wait,1000);
}

console.info("start");
wait();
Run Code Online (Sandbox Code Playgroud)

这是firebug的输出:

start
wait
wait
wait
wait
Run Code Online (Sandbox Code Playgroud)

wait()函数被调用4次然后停止.如果我将超时设置为100毫秒,则呼叫似乎至少工作10/15秒然后停止.

我正在使用:Firefox 12.0 Greasemonkey 0.9.19

greasemonkey settimeout

4
推荐指数
1
解决办法
2652
查看次数

标签 统计

greasemonkey ×2

firefox ×1

settimeout ×1

userscripts ×1