Get IE Browser URL

Hi,

Is there any way to return the current web address / URL from Internet Explorer? I have tried using 'IWebBrowser2::get_LocationURL' from msdn but I am having problems understanding these functions and converting the VB types.

For example, I am loading IE and then want to start capturing the different URL's:

1
2
3
system("start c:\\progra~1\\intern~1\\iexplore.exe http://www.google.com");
 - Capture URL
 - return to file


Thanks in advance!



Any help would be great.

Thanks
closed account (S6k9GNh0)
That system() statement nearly killed me by making me fall out of my chair.

@thomascrabs: In order to do this, you need to ask the web browser itself. This includes Opera, Firefox, IE, whatever. Some might not allow you to grab the URL. Why do you want to do this?
OK. Just to clarify as the above probably doesn't explain very well!

The system() stmnt is purely to open IE. The other bits were just placeholders! I currently have a basic testing tool that does record / playback testing and records basic performance metrics. However, this is currently based on a text file containing a list of URL's.

What I want is something that records or captures URLs from IE as the user navigates about.
My question was to give me some sort of starting point in getting the URL from IE - making this interactive would come later!

My worry is that the only way will be to do some sort of network traffic capture or something complex like that!
closed account (S6k9GNh0)
From what I know, you need to interact with the web browser, they hold the data needed to grab the URL. They should even have functions that allow you to grab an array of URL links (or not, I don't really know). The only reason why WinAPI would have something to do with it is because of IEs large integration with Windows. You might need to make an addon for each browser you want to do this with, I'm not exactly sure.

http://www.iosart.com/firefox/xpcom/
http://blogs.msdn.com/petel/archive/2006/11/07/writing-ie-addons.aspx
Last edited on
So I guess I can go one of two ways - an add on to IE or some sort of network sniffer / proxy server to capture the requests. Both sound very complicated!

I've had a look around for any existing libraries I could use but not really sure what the best option is... does anyone have any specific experience in doing something like this?

I'll keep looking and post back but if anyone can help further that would be great...
Topic archived. No new replies allowed.