0

I'm examining several thousand web pages on a commercial site using a Chrome extension. I want to retrieve the console log entries with load errors and warnings in each page, send them back to background and append the log entries for each page to an array showing all the load errors for the whole site.

Once my script is injected to the page I can write additional messages to the console but how do I access prior console log messages?

jeromekjerome
  • 501
  • 1
  • 8
  • 26
  • TTBOMK you can't but, you can set the injection time in the `manifest.json` of the content script to `"run_at": "document_start"` which should be early enough. If not, perhaps you could go over `chrome.webNavigation` or something like `webRequest.onBeforeSendHeaders` even, although I doubt that would be needed. – Luka Čelebić Apr 07 '18 at 23:51
  • That's a good start but now that my script is active at the start of document load, how do I grab the console messages that are being generated during loading? – jeromekjerome Apr 08 '18 at 01:18
  • I assumed you already had that part up and running, you can check out [this](https://stackoverflow.com/questions/19846078/how-to-read-from-chromes-console-in-javascript) similar question and its answers. – Luka Čelebić Apr 08 '18 at 01:24
  • Note, the spoofing code should be inserted in a script DOM element to override console.log of the page. – wOxxOm Apr 08 '18 at 03:54

0 Answers0