Unanswered How do I access a page fragment in IE9?

  • martes, 17 de abril de 2012 17:17
     
     

    This had worked just fine in IE8, but now fails in IE9. 

    I am using the DOM to access the HTML for a page.  I normally can just access it like this:

       mshtml.IHTMLDocument2 doc = (mshtml.IHTMLDocument2)WebBrowser.Document;
                mshtml.IHTMLElementCollection col = doc.body;

    Now the page I am attempting to access (it is not under my control, it is owned by a separate company, so I cannot change it) does not have all of the nice tags, such as <HTML> and <BODY>.  In IE8, I could still access the html of the page, but in IE9 i get the following error:

    Member not found. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))    at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
       at IfacesEnumsStructsClasses.IHTMLDocument2.get_body()

    I am guessing that since the page does not have proper HTML formatting IE9 is now rejecting.  The problem is that it still displays in the browser fine.  I can see the text I need, but how can I access it.

    Thanks,

    Dave

Todas las respuestas

  • martes, 17 de abril de 2012 19:30
     
     
    Try IHTMLDocument3::documentElement.


    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP