Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Use the `onCompleted` event with a filter for `xmlhttprequest`. This method will run **when the request has finished**. It's possible that the page has not been rendered yet.
- // In background.js:
- chrome.webRequest.onCompleted.addListener(function(details) {
- chrome.tabs.executeScript(details.tabId, {
- file: 'contentscript.js',
- allFrames: true // <-- You might want to tweak this
- });
- }, {
- urls: ['http://example.com/foo.js*'],
- types: ['xmlhttprequest']
- });
- [`chrome.tabs.executeScript`][1] will execute the content script when the page has loaded.
- [1]: http://code.google.com/chrome/extensions/tabs.html#method-executeScript
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement