我已经为greasemonkey写了一个很大的用户脚本,它在firefox中工作得很好,但在chrome中什么都没有发生:(
// ==UserScript==
// @name Name
// @description Desc.
// @author chiefwrigley
// @version 7.3
// @license (CC) chiefwrigley
// @namespace http://userscripts.org/scripts/show/103899
// @include *
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js
// ==/UserScript==哪些函数可以使用,哪些函数不能使用?例如,GM_setvalue...是否存在相等的函数?
发布于 2011-07-10 07:20:42
使用Tampermonkey。它允许几乎所有的GM脚本在Chrome上运行。
要了解Chrome用户脚本允许的内容,请从this table (which needs updating)开始。
发布于 2011-07-10 07:03:39
您可以查看Greasemonkey Wiki以了解跨浏览器兼容性。不过,一个很好的经验法则是,其他浏览器实际上并不支持任何GM_*功能。
特别是对于Chrome,它看起来不支持"@require,@resource,unsafeWindow,GM_registerMenuCommand,GM_setValue或GM_getValue“。和"GM_xmlhttpRequest是同源的“。[Source]
发布于 2012-01-22 18:45:28
如果什么都没有发生,而你又依赖于jQuery,那么可能的原因是chrome没有使用@require,所以jQuery不存在……
我已经写了一个userscript/Greasemonkey模式,它可以让你的jQuery (和UI,以及你需要的任何其他东西)在Chrome和FF以及Opera中都能工作。http://userscripts.org/scripts/show/123588
https://stackoverflow.com/questions/6638021
复制相似问题