Click here to Skip to main content
12,761,216 members (31,083 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# HTML COM

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...

Posted 22-Dec-12 15:51pm
@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

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

    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.";
            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;

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

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170217.1 | Last Updated 23 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100