views:

674

answers:

2

Hi all... I've a vb.net class that is invoked with a context menu extension in Internet Explorer.

The code has access to the object model of the page, and reading data is not a problem. This is the code of a test funcion... it changes the status bar text (OK), prints the page html (OK), changes the html by adding a text and prints again the page html (ok, in the second popup my added text is in the html)

But the Internet Explorer window doesnt't show it. Where am I doing wrong?

   Public Sub CallingTest(ByRef Source As Object)
        Dim D As mshtml.HTMLDocument = Source.document
        Source.status = "Working..."
        Dim H As String = D.documentElement.innerHTML()
        MsgBox(H)
        D.documentElement.insertAdjacentText("beforeEnd", "ThisIsATest")
        H = D.documentElement.outerHTML()
        MsgBox(H)
        Source.status = ""
    End Sub

Function is called by this javascript:

<SCRIPT>
var EB = new ActiveXObject("MyObject.MyClass");
EB.CallingTest(external.menuArguments);
</SCRIPT>
A: 

To the best of my understanding, in order to use insertAdjacentText or any of the other editing methods, the document object should be in the design mode. In design mode you can edit the document freely, and so can the user. Check this site for more details

Alex Shnayder
A: 

I do not think that Alex is right, something else is the matter.

When I tried to do something like that, insertBefore would not work for me, but appendChild worked just fine, so adding an element is possible.

I worked in Javascript, but I don't expect that makes a difference.

buti-oxa