I am creating a chrome extension for facebook. I need to execute the same content script on every page. It works well during the first load but it doesn\'t work when I go to
I personally solved this by using Chrome's webRequest API. You'll want to add a listener that tracks AJAX-generated HTTP calls. Here's essentially the code I used:
chrome.webRequest.onCompleted.addListener(function(details) {
var url = document.createElement('a');
url.href = details.url;
if (url.search && url.search.indexOf('ajaxpipe=1') !== -1) {
console.log('New page via AJAX.');
chrome.tabs.executeScript({'file' : 'test.js'});
}
}, {urls : ["*://*.facebook.com/*"]});