2

I'm trying to detect chrome extensions, but I have a problem. When I try to jQuery.load() something like chrome-extension://jffbcpkfdlpegbadfomimojhgaaoaeed/icon.png or some other file, I get this error:

Denying load of chrome-extension://jffbcpkfdlpegbadfomimojhgaaoaeed/icon.png. Resources must be listed in the web_accessible_resources manifest key in order to be loaded by pages outside the extension. movie.php?id=3079:1
Failed to load resource: net::ERR_FAILED 

Can I avoid web_accessible_resources? I tried to change the capitalization of the filename from something like icon.png to ICON.png without success (like this).

The idea is ONLY to detect extension; nothing else.

I want to do something like this.

Community
  • 1
  • 1
user1721620
  • 505
  • 1
  • 6
  • 13
  • I don't understand why i have -2? I just ask what i don't know to do and what problem i have? – user1721620 May 05 '14 at 15:30
  • Could you post more of your example? You've given us nothing to work with. – Teepeemm May 05 '14 at 18:31
  • Nathing special follow [THIS link](http://www.willhawker.com/what-i-learnt-today/20-11-2012/27) – user1721620 May 05 '14 at 19:23
  • This is using a different extension id. Please post your complete extension. – Teepeemm May 05 '14 at 20:03
  • Yes i need to detect more then one extension. – user1721620 May 05 '14 at 20:35
  • So you're trying to detect if an extension you don't control has been installed, and it doesn't have any web_accessible_resources? Which extension(s) are you trying to detect? – Teepeemm May 05 '14 at 20:52
  • Exactly. Easy Video Downloader Express,FVD Downloader,MoviePile Downloader,Video Downloader professional... and more. – user1721620 May 05 '14 at 20:58
  • Of your examples, #3 doesn't exist, and #2 and #4 have `web_accessible_resources`. #1 lists the manifest entry, but no files match the wildcard. I'd recommend focusing on #1. But now I don't know enough to help you out. – Teepeemm May 05 '14 at 21:23
  • I need detect all, with or without web_accessible_resources. If some extension have web_accessible_resources i just need to open that file (like alexa traffic rank) and i can detect but i have problem where i don't have web_accessible_resources. – user1721620 May 05 '14 at 21:43
  • 1
    Possible duplicate of [Check whether user has a Chrome extension installed](http://stackoverflow.com/questions/6293498/check-whether-user-has-a-chrome-extension-installed) – Simon East Oct 24 '16 at 04:51

1 Answers1

2

If you need to detect that an extension is installed, for any given extension, you should not rely on hacks like loading web-accessible resources (which do not work uniformly for all extensions) and use chrome.management API which is specifically there for this purpose.

chrome.management.get('keyoftheextensionyouwanttofind', function(info){
  if (!info) { console.log("Extension not installed"); }
  else if (!info.enabled) { console.log("Extension installed, but disabled"); }
  else {console.log("Extension installed and active");}
});

Yes, it will trigger a permission warning.

Xan
  • 74,770
  • 16
  • 179
  • 206
  • i don't want to create extension and i don't have extension, this is PHP page not extension – user1721620 May 06 '14 at 22:16
  • Well, this is not clear from your question. Sorry. I don't think you can do it, then, for extensions you don't control. – Xan May 07 '14 at 05:43