Greasemonkey脚本编译器显示错误

Greasemonkey script compiler is showing an error

本文关键字:错误 显示 编译器 脚本 Greasemonkey      更新时间:2024-01-26

我有这样的脚本

// ==UserScript==
// @name          messi
// @namespace     http://messi.com
// @description   example script to alert "barcelona" on userscripts page
// @include       http://userscripts.org/*
// ==/UserScript==
alert('barcelona');

这个剧本适用于Greasemonkey。

我使用以下链接编译了此脚本:
https://arantius.com/misc/greasemonkey/script-compiler.php.

编译后,我在Firefox中添加了附加组件,现在它显示:

错误:WrappedNative原型objec上的非法操作错误。

怎么了?

用户脚本编译器在很长一段时间内没有更新,它生成的输出加载项在最近的Firefox版本IIRC中停止工作。

如果你想从用户脚本中创建Firefox加载项,你应该考虑使用加载项SDK,并将你的用户脚本设置为页面模式。这就是addons.mozilla.org编辑团队的建议。

还有其他选择,比如Scriptify。