Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have yet to find a working solution to this problem online. Hopefully this will make it to the top and save everyone the months of tweaking I spent trying to solve it, and the edge cases associated with it. I have fought over this issue over the years as Microsoft has changed the implementation/reliability of isBusy and document.readystate. With IE8, I had to resort to the following solution. It's similar to the question/answer from Margus with a few exceptions. My code will handle nested frames, javascript/ajax requests and meta-redirects. I have simplified the code for clarity sake, but I also use a timeout function (not included) to reset the webpage after if 5 minutes domAccess still equals false.</p> <pre><code>private void m_WebBrowser_BeforeNavigate(object pDisp, ref object URL, ref object Flags, ref object TargetFrameName, ref object PostData, ref object Headers, ref bool Cancel) { //Javascript Events Trigger a Before Navigate Twice, but the first event //will contain javascript: in the URL so we can ignore it. if (!URL.ToString().ToUpper().StartsWith("JAVASCRIPT:")) { //indicate the dom is not available this.domAccess = false; this.activeRequests.Add(URL); } } private void m_WebBrowser_DocumentComplete(object pDisp, ref object URL) { this.activeRequests.RemoveAt(0); //if pDisp Matches the main activex instance then we are done. if (pDisp.Equals((SHDocVw.WebBrowser)m_WebBrowser.ActiveXInstance)) { //Top Window has finished rendering //Since it will always render last, clear the active requests. //This solves Meta Redirects causing out of sync request counts this.activeRequests.Clear(); } else if (m_WebBrowser.Document != null) { //Some iframe completed dom render } //Record the final complete URL for reference if (this.activeRequests.Count == 0) { //Finished downloading page - dom access ready this.domAccess = true; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload