Is there a way to get the URL when the user opens a web page with a common web browser?
This is a discussion on Getting the URL within the C# Programming forums, part of the General Programming Boards category; Hi! Is there a way to get the URL when the user opens a web page with a common web ...
You can use this project which will allow you to use Dynamic Data Exchange with all the browsers. Then you'd use code like
This will work with "IExplore", "Netscape", "Mosaic", "Netscp6", "Mozilla", "Firefox" at the least, don't see any reason why it wouldn't work with Chrome, but you may have to play around with the library if Google didn't use "Chrome" as the DDE name.Code:using NDde.Client; ... rest of your class ... DdeClient dde = new DdeClient("Firefox", "WWW_GetWindowInfo"); dde.Connect(); string url = dde.Request("URL", int.MaxValue); dde.Disconnect();
Oh, and compared to the IE method above this is really slow.