I'm trying to implement the automatic update feature of my Chrome extension. But for some reason it doesn't work. I have an updates.xml
file hosted on GitHub and I see it gets downloaded (the download counter shows this). But the latest version of the extension is never downloaded.
My manifest.json
looks like:
"version": "0.14.0",
"update_url": "https://github.com/downloads/PeeHaa/cv-pls/updates.xml",
And my updates.xml
looks like:
<?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='bcbifciedokdgkokbbfippkbecnkpclj'>
<updatecheck codebase='https://github.com/downloads/PeeHaa/cv-pls/cv-pls.0.14.0.crx' version='0.14.0' />
</app>
</gupdate>
I've checked and double-checked the appid
and the download URL and they both are correct.
Does anybody have any idea what's going wrong here? Does it have something to do with the fact it is hosted on GitHub?
I've tried this approach before and failed as well. The update.xml file was downloaded correctly, but the newest version of my app wouldn't install.
I found out it doesn't work because github doesn't provide the correct header. If you look at the hosting documentation, the content-type header should be "application/x-chrome-extension".
I just wrote a simple script in php to serve the file for me:
<?php
$file = "";
header("Content-type: application/x-chrome-extension");
header("Content-Disposition: attachment; filename='extension.crx'");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($file));
echo readfile($file);
exit;
curl -v --head http://cloud.github.com/downloads/PeeHaa/cv-pls/cv-pls.0.14.0.crx
and the header Content-Type: application/x-chrome-extension
is present int the response - abraham 2012-04-16 21:09
It looks like both the update.xml and the crx URLs redirect from https://github.com
to https://cloud.github.com
. This is the only reason I can see that would cause the update to fail. Try updating the update.xml codebase URL to include cloud
.