Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello!

How can i open dynamic generated html page in IE with it API or COM? Problem is that it page haven't real link address...

Thanks!
Posted
Comments
AmitGajjar 23-Dec-12 1:18am    
at least you need to store somewhere in your local folder to get it render.
Sergey Shoshin 23-Dec-12 6:07am    
Yes, but professor says that i can't use this variant.
CHill60 23-Dec-12 8:59am    
Do you have to use an API or COM for this exercise or can you use a webbrowser control
Sergey Shoshin 23-Dec-12 9:13am    
In theory i must use api or com. But in the current situation i try to find any way to resolve a problem.

UPD: But i must open page in standard browser(IE, chrome, firefox, etc) - that's why web browser only like a class, not like control.

1 solution

C#
var ie = new InternetExplorer();
ie.Navigate(@"link to some html");
var document = ie.Document;
var frame = document.getElementById("someElementID");
var doc = frame.document;
var p = doc.createElement("p");
p.innerHTML = "This is a new paragraph.";
try
    {
        doc.body.insertAdjacentText("beforeEnd", p.innerHTML);
    }
catch (Exception ex)
    {
            // Error
    }
var destDocument = frame.document;
var srcNode = doc.activeElement;
var newNode = destDocument.importNode(srcNode, true);

destDocument.replaceChild(newNode, destDocument.documentElement);
ie.Visible = true;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900