473,544 Members | 439 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Web Browser Help - Get URL of clicked link?

Hello! I am using the .NET Web Browser control (not Microsoft Web Browser
COM). How can I code this: When the user clicks on a link that will open a
new window/tab, instead of opening Internet Explorer with the link, it
creates a new tab and navigates to that link (my web browser is tab based). I
just need help getting the URL of the clicked link so that the web browser
control on the new tab can navigate to it. Any help?

Matt
Aug 1 '06 #1
3 22565
Hey Matt,

Here is the code that works for me when I tested this out:

public Form1()
{
InitializeCompo nent();

// probably just easier to add this event in from the visual
editor
this.webBrowser 1.NewWindow += new
System.Componen tModel.CancelEv entHandler(this .webBrowser1_Ne wWindow);
this.webBrowser 1.Navigating += new
System.Windows. Forms.WebBrowse rNavigatingEven tHandler(this.w ebBrowser1_Navi gating);
}

private void webBrowser1_Nav igating(object sender,
WebBrowserNavig atingEventArgs e)
{
// the URL that it is going to..
MessageBox.Show (webBrowser1.St atusText.ToStri ng());

// you can just let the browser handle this since it can just
navigate within its current frame... but you could handle it here too

// tell system we want to handle this event ourselves
// e.Cancel = true;
} // end webBrowser1_Nav igating ()
private void webBrowser1_New Window(object sender, CancelEventArgs e)
{
// the URL that it is going to..
MessageBox.Show (webBrowser1.St atusText.ToStri ng());

// Load webBrowser1.Sta tusText.ToStrin g() in new tab

// tell system we want to handle this event ourselves
e.Cancel = true;

} // end webBrowser1_New Window ()

"Mateusz Rajca" wrote:
Hello! I am using the .NET Web Browser control (not Microsoft Web Browser
COM). How can I code this: When the user clicks on a link that will open a
new window/tab, instead of opening Internet Explorer with the link, it
creates a new tab and navigates to that link (my web browser is tab based). I
just need help getting the URL of the clicked link so that the web browser
control on the new tab can navigate to it. Any help?

Matt
Aug 1 '06 #2
Doesnt work. Can you email me a sample:

ma**********@gm ail.com

Matt

"RobKinney1 " wrote:
Hey Matt,

Here is the code that works for me when I tested this out:

public Form1()
{
InitializeCompo nent();

// probably just easier to add this event in from the visual
editor
this.webBrowser 1.NewWindow += new
System.Componen tModel.CancelEv entHandler(this .webBrowser1_Ne wWindow);
this.webBrowser 1.Navigating += new
System.Windows. Forms.WebBrowse rNavigatingEven tHandler(this.w ebBrowser1_Navi gating);
}

private void webBrowser1_Nav igating(object sender,
WebBrowserNavig atingEventArgs e)
{
// the URL that it is going to..
MessageBox.Show (webBrowser1.St atusText.ToStri ng());

// you can just let the browser handle this since it can just
navigate within its current frame... but you could handle it here too

// tell system we want to handle this event ourselves
// e.Cancel = true;
} // end webBrowser1_Nav igating ()
private void webBrowser1_New Window(object sender, CancelEventArgs e)
{
// the URL that it is going to..
MessageBox.Show (webBrowser1.St atusText.ToStri ng());

// Load webBrowser1.Sta tusText.ToStrin g() in new tab

// tell system we want to handle this event ourselves
e.Cancel = true;

} // end webBrowser1_New Window ()

"Mateusz Rajca" wrote:
Hello! I am using the .NET Web Browser control (not Microsoft Web Browser
COM). How can I code this: When the user clicks on a link that will open a
new window/tab, instead of opening Internet Explorer with the link, it
creates a new tab and navigates to that link (my web browser is tab based). I
just need help getting the URL of the clicked link so that the web browser
control on the new tab can navigate to it. Any help?

Matt
Aug 1 '06 #3
I just sent it through my gmail account. I hope I undetstand the question
correctly.

Rob K

"Mateusz Rajca" wrote:
Doesnt work. Can you email me a sample:

ma**********@gm ail.com

Matt
Aug 2 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
3182
by: Tony Marston | last post by:
If the use of the browser's BACK button is interfering with the operation of your web application then take a look at this article entitle "Back Button Blues" http://www.tonymarston.co.uk/php-mysql/backbuttonblues.html -- Tony Marston http://www.tonymarston.net
10
2372
by: Simon Wigzell | last post by:
Is there any way to create and open a window in javascript so that links in other websites won't "steal" it? I've written a web page with a form for people to enter headlines and URLs from newspapers. They will want my window to stay there as they surf through various online newspapers. We don't want their popup links to take over my form...
7
4318
by: George | last post by:
I am trying to set up a login-logout website. I have a cookie about the login status. I put it as logout once the logout link is clicked. And I put a little security check about the status of the cookie variable everytime before loading the detailed member profiling. The page layout is like: Login page,-->check the login name/password...
3
2079
by: Bond | last post by:
how do I know when the browser is making a request to the server? I am not having an onclick event for EVERY hyperlink, submit, etc. There must be some javascript function that I can overwrite that will allow me to do something when the browser requests something from the server. My plan is whenever a browser is about to request...
13
5757
by: zn | last post by:
How can I cause a link on a page to open up a new browser window when the link is clicked on? I've noticed javascript code sometimes when I try to right-click a link and open it in another window. Is there a way to use straight HTML to cause a link to open a new browser window? Thanks.
1
1325
by: Audrey | last post by:
Hi Need some advice here.. I have a frame with a hyperlink to logout from the site When the Logout link (on the left frame) is clicked, a page stating "You've logged out. Please login again" is displayed on the right frame Inside the right frame, there's a hyperlink "login" that enables user to re-login to the site when it is clicked, a new...
6
3919
by: hemant.singh | last post by:
Hi all, I am trying to get a way by which I'll know exactly when user goes out of my site by clicking on close button in browser, So that w/e user click close button in browser, I can send a signal to server. This seems to be achievable with body unload events, but it is little too much, as even if user navigate within my site, this event...
3
3067
by: Jason | last post by:
Hi, I built a vb.Net application that creates ICS calendar files dynamically and then sends them to the client browser as a downloadable file. Works perfectly except in the following situation. If the URL link to the web page is mailed to someone and they click on the link in Outlook and there are no web browsers already opened on their...
1
1755
by: db007 | last post by:
Hi, I have a problem with a current project and the scroll position. I have an AJAX enabled website using Visual Studio 2005 and ASP.Net 2.0. The project also uses masterpages. On the page in question, there is a search section in an AJAX update panel, situated on the left hand side. Upon submitting criteria and pressing a button,...
0
7439
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7376
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7785
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7395
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7722
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5935
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4932
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3433
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3425
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.