// Test 1: Update manifest.json // Replace content_scripts with _content_scripts to see that // Changing the manifest file does not update the extension. // (or simply change the version number) // Test 2: Update contentscript.js // For example, replace alert with confirm. // manifest.json { "name": "Reload test", "version": "1", "content_scripts": [{ "matches": [""], "js": ["contentscript.js"] }], "background": {"scripts":["bg.js"]} } // contentscript.js alert('Test'); // bg.js function reloadOnChange(url, checkIntervalMS) { if (!window.__watchedFiles) { window.__watchedFiles = {}; } (function() { var self = arguments.callee; var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { if (__watchedFiles[url] && __watchedFiles[url] != xhr.responseText) { window.location.reload(); } else { __watchedFiles[url] = xhr.responseText window.setTimeout(self, checkIntervalMS || 1000); } } }; xhr.open("GET", url, true); xhr.send(); })(); } reloadOnChange(chrome.extension.getURL('/manifest.json')); reloadOnChange(chrome.extension.getURL('/contentscript.js'));