The online home of John Pollard

Updating my Chrome extension to manifest version 2

I got an email from Google saying I needed to update the manifest for my "Bing Translate" Chrome extension - which turned out to be slightly trickier than I thought.

According to the depreciation guide, developers need to update the manifest file that describes the extension properties to version 2 reasonably soon - although to be honnest without looking I have absolutely no idea what version Chrome is currently on.

You can see all the code on GitHub if you are interested, but the trickiest change was to do with the improved security model to help prevent cross site scripting attacks. In particular my code calls the Bing Translate API in a JavaScript call to, which I now had to specifically enable in the manifest file.

The line I had to add to the manifest was:

"content_security_policy": "script-src 'self'; object-src 'self'",

... a detailed explanation of which can be found on the Chrome Extensions documentation site

The key point to note is that this only works for https secure websites, but fortunately the Translator API also works via, so once I'd figured that out everything worked again.

If you are one of the users of this slightly useful tool, please go to Tools->Extensions menu and click on "Update Extensions now" to get the updated v1.1.