Upgrading permissions of a Chrome Extensions

We currently have an extension in the Chrome Web Store with many users. We currently request access to foo.site.com but now we'd like to update our permissions so that we can get bar.site.com.

As I understand it now, if we push a new update (new extension version to the Chrome Web Store) requiring these two permissions, existing users will have their extension disabled until they manually re-enable. New users who download the extension after the update will be fine and have both permissions. However, disabling our current users is not an option.

Any way to get around this?

We've looked into optional permissions, which would solve the issue for existing users (we would just ask them to click a button to upgrade the permissions and be on our way). However for new users, they would not only have to install the extension but also accept the optional permissions which sucks. Is there any way for new users to accept all the permission (optional and required) at install time?

Answers


Yes, there is solution. You set the new permissions as optional, and then you request the permission before the user using the new feature. The is work 100%.

This is what you add to your manifest:

"permissions": ["tabs","http://*/*","https://*/*"],

After that you can use:

chrome.permissions.request 

and

chrome.permissions.contains

Facing the same issue with my extension, I came about this post searching for the same question. There is an update that seems acceptable in some cases. According to: https://support.google.com/chrome_webstore/answer/1054246 and the example on http://developer.chrome.com/extensions/permission_warnings.html

Seems that updating your permissions will in fact disable your extension, however it will prompt the user about your change and allow an easy "re-enable".

It might not be acceptable in your scenario, however in my case the win of new users with the added permission by default trumps the risk of existing user not re-enabling. As this is drastically better to the way it was before where your existing users were not aware of the extension being disabled...

I know this post is old, but as it is the top Google result for this question thought an update be good for future reference...


Since chrome 16 you can set optional_permission at install time and ask for elevated permission at run time. See https://developer.chrome.com/extensions/permissions

in manifest.json:

  {
    "name": "My extension",
    ...
    "optional_permissions": [ "tabs", "http://bar.site.com/" ],
    ...
  }

in popup.json:

    document.querySelector('#my-button').addEventListener('click', function(event) {
    // Permissions must be requested from inside a user gesture, like a button's
    // click handler.
    chrome.permissions.request({
      permissions: ['tabs'],
      origins: ['http://bar.site.com/']
    }, function(granted) {
      // The callback argument will be true if the user granted the permissions.
      if (granted) {
        doSomething();
      } else {
        doSomethingElse();
      }
    });
  });

Need Your Help

How to pass variable from jade template file to a script file?

javascript node.js pug

I'm having trouble with a variable (config) declared in a jade template file (index.jade) that isn't passed to a javascript file, which then makes my javascript crash. Here is the file (views/index...

how to import .sql file in mysql database using php

php mysql

how to import .sql file in mysql database using php