【发布时间】:2012-12-05 19:49:00
【问题描述】:
有一个页面http://example.com/1.php照常包含javascript文件:
<script type="text/javascript" src="/util.js?1354729400"></script>
此文件包含我需要在我的用户脚本中使用的名为 exampleFunction 的函数。 我还有一个用户脚本:
// ==UserScript==
// @name SomeName
// @namespace http://example.com/userscripts
// @description Greets the world
// @include http://example.com/*
// ==/UserScript==
window.onload = function () {
console.log(exampleFunction);
alert("LOADED!");
}
在 Firefox 中完美运行并在 Chrome 中返回错误:
Uncaught ReferenceError: exampleFunction is not defined
如何让它发挥作用?
【问题讨论】:
-
尝试禁用 chrome 上的缓存或按 CTRL+F5
标签: javascript google-chrome cross-browser greasemonkey userscripts