سؤال

I am trying transfer data from a Windows Form application to a web browser. I achieve this for IE (Internet Explorer), but now I am trying to transfer this data to all browsers such as Chrome, Mozilla Firefox,Safari.

For IE I am using MSHTML.dll but I don't know to to achieve it for any of the other browsers.

Here is the code I use for IE:

InternetExplorer TargetIE = null;
IHTMLDocument2 document = null;
//Check whether the IE is opened
foreach (InternetExplorer internetExplorer in new ShellWindows())
{
  if (internetExplorer.Document is HTMLDocument)
      {
        TargetIE = internetExplorer;
        break;
      }
}
هل كانت مفيدة؟

المحلول 2

Using XPath You Can handle such kind of stuff

using (var wc = new WebClient())
            {
                var page = wc.DownloadString(arguments);
                HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
                doc.LoadHtml(page);
                HtmlAgilityPack.HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes("//input");
               if (nodes != null)
                {
                    foreach (HtmlAgilityPack.HtmlNode data in nodes)
                    {
                       //Do whatever you want........
                     }
                 }
              } 

also download HtmlAgilityPack dll from this link HtmlAgilityPack

نصائح أخرى

not sure I really understood your confusion. I think maybe you can formate your data as HTML, which is recognized by all the browsers, not only by IE. so, in your program, you should pay attention to fill and organize data into html files, maybe including some javascript. then, you can browse your html in your app using WebBrowser control, and the html also could be accessed by other browsers.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top