I've got 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 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 pop-up my added text is in the HTML)

But the Internet Explorer window doesn'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()
    D.documentElement.insertAdjacentText("beforeEnd", "ThisIsATest")
    H = D.documentElement.outerHTML()
    Source.status = ""
End Sub

The function is called like this from JavaScript:

    var EB = new ActiveXObject("MyObject.MyClass");

No correct solution


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

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow