[2005] WebBrowser Showing New URL Right after it was clicked
first of all .. i'm pretty new @ vb ... but i really would like some help.
i made a simple webbrowser in VB .. Many Tutorial can be found on the net, but i cant create the following:
RIGHT after a user click a new link/url i want the following message be displayed:
msgbox("Going to the following URL:") Then i need the Link that was just clicked.. this message must be displayed before navigating to the link that was hit..
Currently i'm using the Private Sub WebBrowser1_Navigating2 event .. MsgBox(WebBrowser1.Url.ToString()) gives me the old link, not the one that was just hit ..
Can anyone help me please ..
Re: [2005] WebBrowser Showing New URL Right after it was clicked
A thread was just posted asking this question. Scroll down a bit.
Re: [2005] WebBrowser Showing New URL Right after it was clicked
i must be blind .. scrolled 5 pages .. didnt find anything .. what topic are you referring too?
Re: [2005] WebBrowser Showing New URL Right after it was clicked
i think you mean this one .. http://www.vbforums.com/showthread.php?t=504164
but Url.ToString() works but gives the current url .. not the url that was just clicked
Re: [2005] WebBrowser Showing New URL Right after it was clicked
Works fine for me.
Are you sure you are putting it in the correct event? Preferably DocumentCompleted.
Re: [2005] WebBrowser Showing New URL Right after it was clicked
Quote:
Originally Posted by Amien
e.Url.ToString gives you the URL you just clicked if you are looking in the correct event to get it.
The example in the other thread uses the DocumentCompleted event to get the URL because that is the event that fires when a page has completed loading.
The browser has many events though. One of them is the Navigating event. This event fires when a navigation is about to occur, so in this event, look at
to get the value of the page you are about to navigate to.
You could even set
in this event if you wanted to cancel the navigation from happening, lets say if you wanted to block a certain URL from being navigated to.
Re: [2005] WebBrowser Showing New URL Right after it was clicked
i dropped an MsgBox(WebBrowser1.Url.ToString()) in both WebBrowser1_Navigating2 and WebBrowser1_DocumentCompleted..
DocumentCompleted does show the correct URL .. but Navigating2 not .. shows the old URL .. If i need to block some sites i would need the correct URL in Navigating2 and not when the website is showing on the screen(DocumentCompleted)
Re: [2005] WebBrowser Showing New URL Right after it was clicked
solved:
used WebBrowser1.StatusText in WebBrowsingNavigating Event
Re: [2005] WebBrowser Showing New URL Right after it was clicked
addition question:
how can i stop the navigating? WebBrowser1.Stop is not working.
Re: [2005] WebBrowser Showing New URL Right after it was clicked
Quote:
Originally Posted by kleinma
You could even set
in this event if you wanted to cancel the navigation from happening, lets say if you wanted to block a certain URL from being navigated to.
Blarg.