ChromeはウェブストアのURLへのアクセスをブロックしていますか?https://chrome.google.com/webstore/のChrome拡張コンテンツスクリプト
私は+1ボタンの横のようなボタンを表示する拡張をしたいと思いますが、その内容のスクリプトがhttps://chrome.google.com/webstore/ *
に働いていないようにそれはそれが本当であるに見えますか?
ChromeはウェブストアのURLへのアクセスをブロックしていますか?https://chrome.google.com/webstore/のChrome拡張コンテンツスクリプト
私は+1ボタンの横のようなボタンを表示する拡張をしたいと思いますが、その内容のスクリプトがhttps://chrome.google.com/webstore/ *
に働いていないようにそれはそれが本当であるに見えますか?
TL; DRは、ウェブストアは、拡張子によってスクリプト、および以前にあなたが(--allow-scripting-gallery
)has been removed in Chrome 35ことを行うことが許さフラグすることはできません。
Chrome拡張機能では、コンテンツスクリプトの実行/ CSSのChromeウェブストアの挿入はできません。これは、the source codeの関数IsScriptableURL
で明示的に定義されています(前のリンクをクリックすると完全なロジックが表示されます)。
// The gallery is special-cased as a restricted URL for scripting to prevent
// access to special JS bindings we expose to the gallery (and avoid things
// like extensions removing the "report abuse" link).
// TODO(erikkay): This seems like the wrong test. Shouldn't we we testing
// against the store app extent?
GURL store_url(extension_urls::GetWebstoreLaunchURL());
if (url.host() == store_url.host()) {
if (error)
*error = manifest_errors::kCannotScriptGallery;
return false;
}
manifest_errors::kCannotScriptGallery
がhereが定義されています
const char kCannotScriptGallery[] =
"The extensions gallery cannot be scripted.";
あなたがウェブストア]タブでスクリプトを注入するchrome.tabs.executeScript
を使用するときにエラーが背景ページのコンソールで表示することができます。例えば、https://chrome.google.com/webstore/オープン、その後、(ライブデバッグ用のコンソールを介して)延長の背景ページに次のスクリプトを実行します。
chrome.tabs.query({url:'https://chrome.google.com/webstore/*'}, function(result) {
if (result.length) chrome.tabs.executeScript(result[0].id, {code:'alert(0)'});
});
[OK]をコンテンツスクリプトが動作しない、背景ページを経由して道多分あるのでしょうか? これを実行する方法はありません(コマンドラインパラメータ経由以外) – chingo
これ以上動作していないようです(Chrome 31)。私はバグを提出しました - https://code.google.com/p/chromium/issues/detail?id=342090 – kzahel
@kzahelバグを修正しました。あなたは '--allow-scripting-gallery'を(少なくともカナリアのビルドで)使うことができるはずです。 –