• Log in or sign up for an account here: https://www.sythe.org/login

Webbrowser troubles.

Covey

Creator of EliteSwitch

Retired Sectional Moderator
Visual Basic Programmers
Joined
Sep 9, 2005
Sythe Gold
9
Messages
4,510
Age
17
Location
Fuckin' BAM!
How do i stop the webbrowser redirecting to Runescape.com when i try to go to the worlds?

It doesn't seem to have a beforenavigate sub.
I've tried the "navigating" sub but:
Code:
if e.url = "http://www.runescape.com" then
e.cancel = true
end if
doesn't seem to work (it gives some error) :O

Also i saw dodge post this but don't quite understand how to use it:
Code:
Dim Webpage As AxSHDocVw.AxWebBrowser = New AxSHDocVw.AxWebBrowser  'create new browser instance
        AddHandler Webpage.BeforeNavigate2, AddressOf Me.Webpage_BeforeNavigate2
        AddHandler Webpage.NavigateComplete2, AddressOf Me.Webpage_NavigateComplete2
        Webpage.RegisterAsBrowser = True
        Webpage.Silent = True
        Webpage.Visible = True 
        Webpage.Navigate("URL")

EDIT
im gonna probably be posting alot of simple fix questions because im starting in .net now :)
 
Figured it out
Code:
Private Sub webMain_Navigating(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatingEventArgs) Handles webMain.Navigating
        If e.Url.OriginalString = "http://www.runescape.com" Or e.Url.OriginalString = "http://www.runescape.com/" Then
            e.Cancel = True
        End If
    End Sub
 
yea, didnt know that one, thanks..
Code:
If e.Url = New Uri("http://www.runescape.com/") Then e.Cancel = True
that works too..got it from flamingidiots i think
 
Makes sense.
The web browser control doesn't use the string datatype- uses the URI (Uniform Resource Identifier).

'System.Uri is a much safer way of storing URIs. Extensive manipulation of URI related data using plain strings has been shown to cause many security and correctness problems.'

As you have already solved your problem, I'm just explaining it.
 
Runescape Gamblingrunescape gambling
Back
Top