Chrome Script extension content at https://chrome.google.com/webstore/

Does Chrome Prevent Web Store URLs?

I would like to make an extension that displays a similar button next to the +1 button, but it looks like the content scripts are not working on https://chrome.google.com/webstore/ *

It's true?

+24
source share
1 answer

TL DR Webstore cannot be scripted with extensions, and the flag that previously allowed you to do this ( --allow-scripting-gallery) was removed in Chrome 35 .

Chrome / CSS - Chrome. , 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 :

const char kCannotScriptGallery[] =
    "The extensions gallery cannot be scripted.";

, chrome.tabs.executeScript script Web Store. , https://chrome.google.com/webstore/, script ( , )

chrome.tabs.query({url:'https://chrome.google.com/webstore/*'}, function(result) {
    if (result.length) chrome.tabs.executeScript(result[0].id, {code:'alert(0)'});
});
+28

All Articles