Retrieve URL from Web Browser
-
Hello, Can anybody plz tell me how do i retrieve URL from a Web Browser in VB. i dont want only for Internet Explorer but it shuld be general and work for every browser. Atleast tell me the API or the steps of how to start. Some explainations would be nice. Thanks Angad
-
Hello, Can anybody plz tell me how do i retrieve URL from a Web Browser in VB. i dont want only for Internet Explorer but it shuld be general and work for every browser. Atleast tell me the API or the steps of how to start. Some explainations would be nice. Thanks Angad
It's different for every web browser because they are architected differently. For IE, you can either host the WebBrowser control and use the
LocationURL
property. To do it from an outside process, you'll have to search the running Windows classes for the correct class, search it's child windows for the address bar, and read the text out of it (or get an instance of the IWebBrowser2 interface from the app, but this can be more difficult). For Mozilla/Netscape, there's different ways. You could use the same approach from an outside application as I outlined above, but the Windows classes would be different for both the browser and the address bar. Same goes for Opera and the other browsers. There is no single way of doing this for all browsers.-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----
-
Hello, Can anybody plz tell me how do i retrieve URL from a Web Browser in VB. i dont want only for Internet Explorer but it shuld be general and work for every browser. Atleast tell me the API or the steps of how to start. Some explainations would be nice. Thanks Angad
What are you trying to accomplish? Are you writing vb code in an .aspx file and need to get the current URL (server end programming)? Are you writing (client end) vb script in a web page? This might be a simple answer depending on what you're trying to do. Can you be more specific?