Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# HTML COM
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 22-Dec-12 14:51pm
Comments
@AmitGajjar at 23-Dec-12 1:18am
   
at least you need to store somewhere in your local folder to get it render.
Sergey Shoshin at 23-Dec-12 6:07am
   
Yes, but professor says that i can't use this variant.
CHill60 at 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 at 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
good
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.";
    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;
  Permalink  

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



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