How do I auto-reload a Chrome extension I'm developing? How do I auto-reload a Chrome extension I'm developing? google-chrome google-chrome

How do I auto-reload a Chrome extension I'm developing?


You can use "Extensions Reloader" for Chrome:

Reloads all unpacked extensions using the extension's toolbar button or by browsing to "http://reload.extensions"

If you've ever developed a Chrome extension, you might have wanted to automate the process of reloading your unpacked extension without the need of going through the extensions page.

"Extensions Reloader" allows you to reload all unpacked extensions using 2 ways:

1 - The extension's toolbar button.

2 - Browsing to "http://reload.extensions".

The toolbar icon will reload unpacked extensions using a single click.

The "reload by browsing" is intended for automating the reload process using "post build" scripts - just add a browse to "http://reload.extensions" using Chrome to your script, and you'll have a refreshed Chrome window.

Update: As of January 14, 2015, the extension is open-sourced and available on GitHub.


Update: I have added an options page, so that you don't have to manually find and edit the extension's ID any more. CRX and source code are at: https://github.com/Rob--W/Chrome-Extension-Reloader
Update 2: Added shortcut (see my repository on Github).
The original code, which includes the basic functionality is shown below.


Create an extension, and use the Browser Action method in conjunction with the chrome.extension.management API to reload your unpacked extension.

The code below adds a button to Chrome, which will reload an extension upon click.

manifest.json

{    "name": "Chrome Extension Reloader",    "version": "1.0",    "manifest_version": 2,    "background": {"scripts": ["bg.js"] },    "browser_action": {        "default_icon": "icon48.png",        "default_title": "Reload extension"    },    "permissions": ["management"]}

bg.js

var id = "<extension_id here>";function reloadExtension(id) {    chrome.management.setEnabled(id, false, function() {        chrome.management.setEnabled(id, true);    });}chrome.browserAction.onClicked.addListener(function(tab) {    reloadExtension(id);});

icon48.png: Pick any nice 48x48 icon, for example:
Google ChromeGoogle Chrome


in any function or event

chrome.runtime.reload();

will reload your extension (docs). You also need to change the manifest.json file, adding:

..."permissions": [ "management" , ...]...