Question

Below is the code i use to alter the HTML displayed in IE. However it always throws exception - Could not set the outerHTML property. Invalid target element for this operation. Ain't it possible to set the outerHTML?

protected void AlterContent(ref HTMLDocument docInput, HTMLDocument docAlteredOutPut)
{
    try
    {
        if (docInput.body.tagName.ToLower() == "body" && docAlteredOutPut.body.innerHTML != null)
        {
            docInput.documentElement.outerHTML = docAlteredOutPut.documentElement.outerHTML;
        }
    }
    catch
    {
    }
}

Thanks.

No correct solution

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