,有一個頁面http://example.com/1.php包括JavaScript文件和往常一樣:window.onload適用於Firefox + Greasemonkey腳本,但不適用於Chrome用戶腳本?
<script type="text/javascript" src="/util.js?1354729400"></script>
此文件包含名爲exampleFunction,我需要在我的userscript使用功能。 我也有一個用戶腳本:
// ==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 – Ibu
它沒有幫助 – Alex