no

Learn Spicie Dynamically Adding Elements to Document Object

See code below: Using SpicIE's OnDocumentComplete event void SpicIE1_OnDocumentComplete(object pDisp, ref object url) { ...

See code below:

Using SpicIE's OnDocumentComplete event
void SpicIE1_OnDocumentComplete(object pDisp, ref object url)
        {
            if (url.ToString().IndexOf("msn") > 0)
            {
                if (pDisp is IWebBrowser2)
                {
                    try
                    {
                        var webBrowser = pDisp as IWebBrowser2;
                        var doc2 = webBrowser.Document as IHTMLDocument2;

                        var element = doc2.createElement("h1");
                        element.innerHTML = "Hello World";
                        element.setAttribute("style", "border: 1px solid red;", 1);
                        
                        doc2.body.insertAdjacentHTML("beforeBegin", element.outerHTML);
                        doc2.close();
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show("Plugin is not loaded properly.");
                    }
                }
            }
        }

Related

web 1760043633040743079

Post a Comment Default Comments

item