3

I have Chrome extension published on Chrome web store.

Now I want to implement Inline installation from page on my website.

I was following thischrome tutorial.

So I added my website as verified site for my Chrome extension and inline installation is working fine.

The issue which I have is how to check does user already have my extension installed.

I want to first check does user have extension installed and if so don't show installation button and otherwise to show it.

In chrome tutorial for inline installation there is explanation how to check is extension already installed by checking chrome.app.isInstalled

But this is always returning false, even if extension is installed. I cannot find any detail explanation of using this property. I am wondering how it even conclude which extension I am checking? Does it conclude from chrome <link> in head:

<link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/itemID">

Any help, how properly to check does user have my extension installed or not?

carpics
  • 2,272
  • 4
  • 28
  • 56
  • 1
    `chrome.app.isInstalled` is intended for installed Chrome web apps, not for extensions (these are [different things](https://developer.chrome.com/webstore/apps_vs_extensions)). See [this answer in FAQs](https://developer.chrome.com/webstore/faq#faq-app-24). You need to use web accessible resource as Mottie suggests. – Petr Srníček Jun 08 '16 at 08:25

1 Answers1

2

I saw a security video on YouTube, I don't have a link anymore, but I think it was a DefCon talk, or something... it shows how Chrome allows access to extension resources from a browser URL if the resource is included in the extension list of web_accessible_resources in the manifest.json. This probably isn't a good thing...

So potentially you could:

  • Create an image that says something like the extension is installed and active.
  • Add this image to your extension, and include it in the manifest.json under the web_accessible_resources list.
  • Then link to it on your webpage. The image will only be visible if the extension is installed and enabled.

    <img src="chrome-extension://{extension-id}/extension-enabled.png">
    
  • Use javascript to check and see if the image loaded. If it didn't, replace it with a url showing that the extension is disabled or not-installed.

Mottie
  • 84,355
  • 30
  • 126
  • 241