1

I want to develop a Chrome extension that scrapes data off the page, but this can happen only after all of the pages ajax finish loading their remote content.

Is this possible?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
simonwjackson
  • 1,818
  • 4
  • 25
  • 33

2 Answers2

2

In general, you can't detect when all scripts are finished loading. It is fairly common for a page to wait a couple seconds after the 'onload' event to request an additional round of scripts -- for example, if you want to delay-load ads but don't want to slow down the initial page rendering.

However, extensions do have a flag to run at "document_idle". This flag supposedly makes Chrome wait until the page is "idle" before injected the extension's script. It would not, however wait for a delay-loaded script and it may not even wait for a slow XHR.

More information can be found at http://developer.chrome.com/extensions/content_scripts.html

James deBoer
  • 2,477
  • 15
  • 17
-1

I think you can't do that, but if you want to check if a particular external script is loaded you can check this: Verify External Script Is Loaded

  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/31358282) – Nick Vu Mar 28 '22 at 14:50