简体   繁体   中英

Remotely Open Default WebBrowser and access its methods, properties and values

What I'm trying to do is to, from a Web Service (WCF), give a remote computer (the Web Service Consumer) the instruction to open its default Web Browser (be it Internet Explorer, Firefox, Chrome, etc.), navigate to a certain web page and keep monitoring the events of that browser so that I can capture a certain value from the Document Title at a certain point, and do stuff with it.

I'm already able to send the command to open Internet Explorer and navigate to a URL, from the Web Service to the remote computer (my consumer), but I don't like the approach since I can't monitor the Document.Title property for changes nor access its value at any given time. Here is an example:

using System.Diagnostics;

public void DoIt();
{
  Process batchProcess = new Process();
  batchProcess.StartInfo.FileName = "iexplore.exe";
  batchProcess.StartInfo.Arguments = "http://whatever.com";
  batchProcess.Start();
}

This opens up Internet Explorer on the remote machine and navigates to the Url I give it, but I can't keep watch for the Browser's Events or Properties Values....

Can somebody help? ;-)

I don't think you can access information in one application (the web browser) from another (the WCF client) like that, and it's certainly not possible to do it without knowing what the user's default browser is.

You might have more luck using a WebBrowser control (WPF or Windows Forms), which embeds Internet Explorer's engine into the application and allows you access to the document title.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM