How to detect when a web page has finished rendering?

3D WebView's IWebView.LoadProgressChanged event fires when the web page's document.readyState is "complete", which means that the document and all of its subresources have have finished loading. So, for a simple HTML page, the LoadProgressChanged event can be used to detect when a page has finished rendering. However, some web pages use JavaScript to dynamically modify or re-render the page after it has finished loading. For example, that's how many pages that use React.js work. For pages like that, 3D WebView is unable to detect when the web page's JavaScript has finished modifying the page, so there isn't a built-in event for detecting that. If your web page dynamically re-renders itself using JavaScript like that, here are some suggestions for detecting when the page has finished re-rendering:

  1. One option is to detect when the page has finished loading using LoadProgressChanged and then wait an additional fixed delay (for example: 500ms) to give time for the page's JavaScript to finish re-rendering the page.

  2. If the web page is one that you control, another option is to update the page's JavaScript so that when it finishes dynamically re-rendering the page, it sends a message to your application's C# to indicate when it has finished.