Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I check if a Google Chrome Extension needs to be updated?

I know for extensions hosted on the webstore, when I push updates Google will automatically update the extensions of users but there is a lag (couple of hours).

Is there a way for the extension to detect if there is a new update that hasn't been applied? The easiest way to do this would be to somehow query for the current version on the webstore and compare it to the installed version and I was wondering if there was anything in the API for this.

I know that chrome.app.getDetails().version gives me the current installed version but is there a way to get the current web store version? Thanks.

In the worst case, I could issue an http get for my extensions web store page and extract the version out from there but that seems to be super hacky so I'd prefer not to do it this way.

like image 558
Harry Jiang Avatar asked May 14 '15 19:05

Harry Jiang


People also ask

How often does Chrome check for extension updates?

Every few hours, the browser checks whether any installed extensions or apps have an update URL. For each one, it makes a request to that URL looking for an update manifest XML file. If the update manifest mentions a version that is more recent than what's installed, the browser downloads and installs the new version.


1 Answers

You missed it, it's in the chrome.runtime API:

chrome.runtime.requestUpdateCheck(function callback)

Requests an update check for this app/extension.

Do note that the server may throttle your requests. You are supposed to check for its response in the callback and reduce your request frequency if that happens.

If you want to be even more proactive about that, you could implement push notifications for your update check. That's probably overkill, though - considering Web Store runs automated checks on updates that can last up to an hour anyway after you publish.

like image 164
Xan Avatar answered Nov 04 '22 11:11

Xan