<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Playing on the frontier &#187; crx</title>
	<atom:link href="http://siphon9.net/loune/tag/crx/feed/" rel="self" type="application/rss+xml" />
	<link>http://siphon9.net/loune</link>
	<description></description>
	<lastBuildDate>Sun, 19 Feb 2012 05:57:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Getting the version number of your own Chrome Extension</title>
		<link>http://siphon9.net/loune/2010/07/getting-the-version-number-of-your-own-chrome-extension/</link>
		<comments>http://siphon9.net/loune/2010/07/getting-the-version-number-of-your-own-chrome-extension/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 12:58:06 +0000</pubDate>
		<dc:creator>Loune</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[crx]]></category>

		<guid isPermaLink="false">http://siphon9.net/loune/?p=163</guid>
		<description><![CDATA[Following on from yesterday&#8217;s post about getting the version number of your own firefox extension, what if you were now developing a Google Chrome extension and want the same thing? Google Chrome&#8217;s extension API is much more limited that Firefox&#8217;s. There&#8217;s no explicit extension-metadata-getting API that I know of. However, we do know that the [...]]]></description>
			<content:encoded><![CDATA[<p>Following on from yesterday&#8217;s post about <a href="/loune/2010/07/getting-your-firefox-extension-version-number/">getting the version number</a> of your own firefox extension, what if you were now developing a Google Chrome extension and want the same thing? Google Chrome&#8217;s extension API is much more limited that Firefox&#8217;s. There&#8217;s no explicit extension-metadata-getting API that I know of. However, we do know that the version information is tucked away in manifest.json. With this knowledge and coupled with a few friendly APIs (XMLHttpRequest &#038; JSON.parse) we can now have the equivalent function for chrome:</p>
<pre class="brush: jscript; title: ; notranslate">
function getVersion(callback) {
        var xmlhttp = new XMLHttpRequest();
        xmlhttp.open('GET', 'manifest.json');
        xmlhttp.onload = function (e) {
            var manifest = JSON.parse(xmlhttp.responseText);
            callback(manifest.version);
        }
        xmlhttp.send(null);
}

// to use
var version;
getVersion(function (ver) { version = ver; });
// version is populated after an indeterminate amount of time
</pre>
<p>As XMLHttpRequest is asynchronous, our method needs a callback to receive the version information. You can also get whatever other information you want in your mainfest.json. So there you go.</p>
]]></content:encoded>
			<wfw:commentRss>http://siphon9.net/loune/2010/07/getting-the-version-number-of-your-own-chrome-extension/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

