如何覆盖警报功能?

在网站上有类似的代码(其网站上的网站)
<script language="JavaScript" type="text/javascript">         
    alert("ble");
</script>
我尝试使用GM禁用该警报。我试图这样做
unsafeWindow.alert=function() {};
但我看到警报并得到此错误
Error: uncaught exception: [Exception... "Component is not available"  nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)"  location: "JS frame :: file:///C:/Documents%20and%20Settings/arokitnicki/Dane%20aplikacji/Mozilla/Firefox/Profiles/sm4bsods.default/extensions/%7Be4a8a97b-f2ed-450b-b12d-ee082ba24781%7D/components/greasemonkey.js :: anonymous :: line 377"  data: no]
如何禁用该警报? 附:这不是Javascript问题,而是关键问题。 编辑: 它的公司的网站,所以我无法粘贴真正的代码
<head>
    <script>    
        dojo.require("dojo.back");
        dojo.back.init(); 
    </script>
</head>
<body onload="someMethod()">
    <iframe></iframe>
    <script>         
        alert("bla");
    </script>
</body>
标题中还有一些脚本和CSS声明。     
已邀请:
更新:对于Greasemonkey的现代版本: 在大多数情况下,你可以使用
@run-at document-start
拦截
alert()
。例如,加载此脚本然后访问测试页面:
// ==UserScript==
// @name            Overwrite Alert
// @description     Overwrites alert()
// @include         http://output.jsbin.com/*
// @grant           none
// @run-at          document-start
// ==/UserScript==

unsafeWindow.alert=function (str) {
    console.log ("Greasemonkey intercepted alert: ", str);
};
如果您的脚本需要GM_函数,则必须设置
@grant
而不是none。在这种情况下使用
exportFunction()
如下:
// ==UserScript==
// @name            Overwrite Alert
// @description     Overwrites alert()
// @include         http://output.jsbin.com/*
// @grant           GM_addStyle
// @run-at          document-start
// ==/UserScript==

function myAlert (str) {
    console.log ("Greasemonkey intercepted alert: ", str);
}
unsafeWindow.alert   = exportFunction (myAlert, unsafeWindow);
旧答案,2011年8月之前的Greasemonkey:
unsafeWindow.alert=function() {};
在特定情况下工作正常。 但是,如果这确实是页面上的代码,那么您将无法使用Greasemonkey停止该警报。 这是因为该警报将在页面加载期间和
DOMContentLoaded
事件之前触发 - 这是Greasemonkey被触发的时间。 加载此GM脚本:
// ==UserScript==
// @name            Overwrite Alert
// @description     Overwrites alert()
// @include         http://jsbin.com/*
// ==/UserScript==

unsafeWindow.alert=function() {};
然后访问:http://jsbin.com/ajeqe4/6。 检查代码(http://jsbin.com/ajeqe4/6/edit),您将看到3个警报。 Greasemonkey只能停止在
load
(通常)发射的警报。 其他因素可以阻止GM停止警报的能力......页面加载速度太快或者关闭。 在pastebin.com上粘贴该页面的源代码(如果可能的话,未经编辑)。您可以做其他事情。也许通过adblock阻止脚本? 否则,您必须编写扩展/附加组件。     
如果您使用Scriptish,则以下内容始终有效:
// ==UserScript==
// @id              alert-killer-test@erikvold.com
// @name            Overwrite Alert
// @description     Overwrites alert()
// @include         *
// @run-at          document-start
// ==/UserScript==

unsafeWindow.alert=function() {};
您可以在此处获取用户脚本。     

要回复问题请先登录注册