Make links open up in a new tab and not in IE

Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
7 posts Page 1 of 1
Contributors
User avatar
harmeister
VIP - Donator
VIP - Donator
Posts: 26
Joined: Fri Jul 23, 2010 1:21 am

I am using VB 2008 and I have been in the process of my own web browser and I need to know how to right click on a link and click on new window for it to pop up in new window or new tab. Does any one know how to do this?
Sincerely,
Harley
[Information Technologist in training, New to the whole VB coding]
User avatar
Cheatmasterbw
Coding God
Coding God
Posts: 1506
Joined: Fri Jan 01, 2010 2:30 pm

Try this:
Code: Select all
Private Sub WebBrowser1_Navigating(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatingEventArgs) Handles WebBrowser1.Navigating
    Dim VarName as Uri
    e.Cancel = True
    VarName = e.Url
    'Do what you need to do with VarName to make it open in a new tab/window
End Sub
I did not test this code, so i hope it helps!
http://www.megaapps.tk/
User avatar
harmeister
VIP - Donator
VIP - Donator
Posts: 26
Joined: Fri Jul 23, 2010 1:21 am

It does in some cases, but it really doesn't solve my problem, when I click on a link in my browser the open in a new tab option in disabled and open to a new windows is enabled, but it opens it in IE and not the browser I am making, is there a way to change that?
Sincerely,
Harley
[Information Technologist in training, New to the whole VB coding]
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

Make yours from scratch :) I'm half way in mine and that is built from scratch!
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
User avatar
MrBrockWalker
VIP - Donator
VIP - Donator
Posts: 171
Joined: Mon Jul 05, 2010 10:30 am

Try this.
Code: Select all
Dim htmlElement1 As HtmlElement = WebBrowser1.Document.ActiveElement
Dim s1 As String = htmlElement1.GetAttribute("href")
WebBrowser1.Navigate(s1)
You will need to edit it to work with tabs
Visit BW Photography and check out my photos!
User avatar
zachman61
VIP - Donator
VIP - Donator
Posts: 1892
Joined: Wed Dec 16, 2009 9:56 pm

thanks cooll;
Nailing my feet to the floor is easier than using my own muscles to balance, but you don't see me doing that :)
Lewis
Coding God
Coding God
Posts: 1564
Joined: Sun Dec 20, 2009 2:12 pm

You wall also have to add e.Cancel = true to your code i think :P
Image
7 posts Page 1 of 1
Return to “Tutorial Requests”