通常通りのJavaScriptファイルを含むページhttp://example.com/1.phpがあります:window.onloadはFirefox + Greasemonkeyスクリプトでは動作しますが、Chromeのuserscriptでは動作しませんか?
<script type="text/javascript" src="/util.js?1354729400"></script>
このファイルには、私は私のuserscriptで使用する必要がexampleFunctionという名前の関数が含まれています。私はそれを動作させるにはどうすればよい
Uncaught ReferenceError: exampleFunction is not defined
:Firefoxで完璧に動作し、Chromeでエラーを返します
// ==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!");
}
: はまた、私はユーザースクリプトを持っていますか?
クロムのキャッシュを無効にするか、Ctrl + F5を押してみてください。 – Ibu
助けにならない – Alex