Ejemplo n.º 1
0
 private bool IsFrameInDocument(HTMLDocument doc, string contexturl)
 {
     for (int i = 0; i < doc.frames.length; i++)
     {
         object             itemRef = i;
         mshtml.HTMLWindow2 frmElem = (HTMLWindow2)doc.frames.item(ref itemRef);
         HTMLIFrame         frm     = (HTMLIFrame)frmElem.frameElement;
         if (frm.src != null)
         {
             string temp = frm.src;
             Debug.WriteLine("Found Frame: " + temp);
             if (contexturl.EndsWith(frm.src, StringComparison.InvariantCultureIgnoreCase))
             {
                 return(true);
             }
         }
         if (frmElem.document != null)
         {
             HTMLDocument subdoc = (HTMLDocument)frmElem.document;
             if (IsFrameInDocument(subdoc, contexturl))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Ejemplo n.º 2
0
        private void runjs()
        {
            var            docx  = webBrowser2.Document;
            var            frame = docx.Window.Frames;
            IHTMLDocument3 doci  = CorssDomainHelper.GetDocumentFromWindow(frame["course_frm"].DomWindow as IHTMLWindow2);
            HTMLIFrame     if2   = doci.getElementById("course_frame") as HTMLIFrameClass;

            if2.contentWindow.execScript(tb4.Text);
        }