How to debug Google Chrome background script? [duplicate]

enter image description here

and also if your console.log("it works!"); does not show up, then that's mean chrome.history.onVisited is not fired yet.

ps: For function(HistoryItem result), you may want to change it to function(result).


This response might be late but would help the rest. if your background.html has javascript errors then the page will not load (to inspect).

To find out whats wrong with your background.html, under chrome://chrome/extensions/ (i.e., manage extensions), click on the background.html link. This will load the developer tools but without background.html. At the botton-right of the window, you will see a red error symbol, and clicking on it will provide line numbers that needs to be fixed.